micropython

Change of lib/builtins.py

246:af6a631171bc
lib/builtins.py
     1.1 --- a/lib/builtins.py	Mon Jun 15 00:40:25 2009 +0200
     1.2 +++ b/lib/builtins.py	Sun Jun 21 02:02:53 2009 +0200
     1.3 @@ -336,7 +336,13 @@
     1.4  def isinstance(obj, cls_or_tuple): pass
     1.5  def issubclass(obj, cls_or_tuple): pass
     1.6  def iter(collection_or_callable, sentinel=None): pass
     1.7 -def len(obj): pass
     1.8 +
     1.9 +def len(obj):
    1.10 +
    1.11 +    "Implementation of len."
    1.12 +
    1.13 +    return obj.__len__()
    1.14 +
    1.15  def locals(): pass
    1.16  def map(function, *args): pass
    1.17  def max(*args): pass
    1.18 @@ -346,7 +352,16 @@
    1.19  def ord(c): pass
    1.20  def pow(x, y, z=None): pass
    1.21  def property(fget=None, fset=None, fdel=None, doc=None): pass
    1.22 -def range(start_or_end, end=None, step=None): pass
    1.23 +
    1.24 +def range(start_or_end, end=None, step=1):
    1.25 +
    1.26 +    "Implementation of range."
    1.27 +
    1.28 +    l = []
    1.29 +    for i in xrange(start_or_end, end, step):
    1.30 +        l.append(i)
    1.31 +    return l
    1.32 +
    1.33  def raw_input(prompt=None): pass
    1.34  def reduce(function, sequence, initial=None): pass
    1.35  def reload(module): pass