micropython

lib/builtins.py

214:398f466a7011
2009-05-16 Paul Boddie Added notes about star parameter handling approaches. Made minor documentation/comment fixes.
     1 #!/usr/bin/env python     2      3 """     4 Simple built-in classes and functions.     5      6 Copyright (C) 2005, 2006, 2007, 2008 Paul Boddie <paul@boddie.org.uk>     7      8 This program is free software; you can redistribute it and/or modify it under     9 the terms of the GNU General Public License as published by the Free Software    10 Foundation; either version 3 of the License, or (at your option) any later    11 version.    12     13 This program is distributed in the hope that it will be useful, but WITHOUT    14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS    15 FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more    16 details.    17     18 You should have received a copy of the GNU General Public License along with    19 this program.  If not, see <http://www.gnu.org/licenses/>.    20 """    21     22 class object:    23     def __init__(self): pass    24     def __bool__(self): pass    25     def __iadd__(self, other): pass    26     27 class basestring(object):    28     def __init__(self, x=None): pass    29     def __getitem__(self, index): pass    30     def __getslice__(self, start, end=None): pass    31     def __iadd__(self, other): pass    32     def __add__(self, other): pass    33     def __radd__(self, other): pass    34     def __mul__(self, other): pass    35     def __rmul__(self, other): pass    36     def __mod__(self, other): pass    37     def __rmod__(self, other): pass    38     def __lt__(self, other): pass    39     def __gt__(self, other): pass    40     def __le__(self, other): pass    41     def __ge__(self, other): pass    42     def __eq__(self, other): pass    43     def __ne__(self, other): pass    44     def __len__(self): pass    45     def __str__(self): pass    46     def __bool__(self): pass    47     def join(self, l): pass    48     49 class bool(object):    50     def __bool__(self): pass    51     def __str__(self): pass    52     53 class buffer(object):    54     def __init__(self, size): pass    55     def append(self, s): pass    56     def __str__(self): pass    57     58 class complex(object):    59     def __init__(self, real, imag=None): pass    60     61 class dict(object):    62     def __init__(self, *args): pass    63     def __setitem__(self, key, value): pass    64     def __getitem__(self, key): pass    65     66 class file(object):    67     def write(self, s): pass    68     69 class float(object):    70     def __init__(self, number_or_string=None): pass    71     def __iadd__(self, other): pass    72     def __isub__(self, other): pass    73     def __add__(self, other): pass    74     def __radd__(self, other): pass    75     def __sub__(self, other): pass    76     def __rsub__(self, other): pass    77     def __mul__(self, other): pass    78     def __rmul__(self, other): pass    79     def __div__(self, other): pass    80     def __rdiv__(self, other): pass    81     def __floordiv__(self, other): pass    82     def __rfloordiv__(self, other): pass    83     def __mod__(self, other): pass    84     def __rmod__(self, other): pass    85     def __pow__(self, other): pass    86     def __rpow__(self, other): pass    87     def __lt__(self, other): pass    88     def __gt__(self, other): pass    89     def __le__(self, other): pass    90     def __ge__(self, other): pass    91     def __eq__(self, other): pass    92     def __ne__(self, other): pass    93     def __neg__(self): pass    94     def __pos__(self): pass    95     def __str__(self): pass    96     def __bool__(self): pass    97     98 class frozenset(object):    99     def __init__(self, iterable): pass   100    101 class function(object):   102     pass   103    104 class int(object):   105     def __init__(self, number_or_string=None): pass   106     def __iadd__(self, other): pass   107     def __isub__(self, other): pass   108     def __add__(self, other): pass   109     def __radd__(self, other): pass   110     def __sub__(self, other): pass   111     def __rsub__(self, other): pass   112     def __mul__(self, other): pass   113     def __rmul__(self, other): pass   114     def __div__(self, other): pass   115     def __rdiv__(self, other): pass   116     def __floordiv__(self, other): pass   117     def __rfloordiv__(self, other): pass   118     def __mod__(self, other): pass   119     def __rmod__(self, other): pass   120     def __pow__(self, other): pass   121     def __rpow__(self, other): pass   122     def __and__(self, other): pass   123     def __rand__(self, other): pass   124     def __or__(self, other): pass   125     def __ror__(self, other): pass   126     def __xor__(self, other): pass   127     def __rxor__(self, other): pass   128     def __lt__(self, other): pass   129     def __gt__(self, other): pass   130     def __le__(self, other): pass   131     def __ge__(self, other): pass   132     def __eq__(self, other): pass   133     def __ne__(self, other): pass   134     def __neg__(self): pass   135     def __pos__(self): pass   136     def __str__(self): pass   137     def __bool__(self): pass   138    139 class list(object):   140     def __init__(self, args=()): pass   141     def __getitem__(self, index): pass   142     def __setitem__(self, index, value): pass   143     def __getslice__(self, start, end=None): pass   144     def __setslice__(self, start, end, slice): pass   145     def append(self, value): pass   146     def __len__(self): pass   147     def __add__(self, other): pass   148     def __iadd__(self, other): pass   149     def __str__(self): pass   150     def __iter__(self): pass   151     def __bool__(self): pass   152    153 class long(object):   154     def __init__(self, number_or_string=None): pass   155     def __iadd__(self, other): pass   156     def __isub__(self, other): pass   157     def __add__(self, other): pass   158     def __radd__(self, other): pass   159     def __sub__(self, other): pass   160     def __rsub__(self, other): pass   161     def __mul__(self, other): pass   162     def __rmul__(self, other): pass   163     def __div__(self, other): pass   164     def __rdiv__(self, other): pass   165     def __floordiv__(self, other): pass   166     def __rfloordiv__(self, other): pass   167     def __and__(self, other): pass   168     def __rand__(self, other): pass   169     def __or__(self, other): pass   170     def __ror__(self, other): pass   171     def __xor__(self, other): pass   172     def __rxor__(self, other): pass   173     def __lt__(self, other): pass   174     def __gt__(self, other): pass   175     def __le__(self, other): pass   176     def __ge__(self, other): pass   177     def __eq__(self, other): pass   178     def __ne__(self, other): pass   179     def __neg__(self): pass   180     def __pos__(self): pass   181     def __str__(self): pass   182     def __bool__(self): pass   183    184 class set(object):   185     def __init__(self, iterable): pass   186    187 class slice(object):   188     def __init__(self, start_or_end, end=None, step=None): pass   189    190 class str(basestring):   191     pass   192    193 class type(object):   194     pass   195    196 class tuple(object):   197     def __init__(self, args): pass   198     def __getitem__(self, index): pass   199     def __getslice__(self, start, end=None): pass   200     def __len__(self): pass   201     def __add__(self, other): pass   202     def __str__(self): pass   203     def __iter__(self): pass   204     def __bool__(self): pass   205    206 class unicode(basestring):   207     pass   208    209 class xrange(object):   210     def __init__(self, start_or_end, end=None, step=1): pass   211     def __iter__(self): pass   212     def next(self): pass   213    214 # Exceptions and warnings.   215    216 class BaseException(object):   217     def __init__(self, *args): pass   218    219 class Exception(BaseException): pass   220 class Warning(object): pass   221    222 class ArithmeticError(Exception): pass   223 class AssertionError(Exception): pass   224 class AttributeError(Exception): pass   225 class DeprecationWarning(Exception): pass   226 class EOFError(Exception): pass   227 class EnvironmentError(Exception): pass   228 class FloatingPointError(Exception): pass   229 class FutureWarning(Warning): pass   230 class GeneratorExit(Exception): pass   231 class IndexError(Exception): pass   232 class IOError(Exception): pass   233 class ImportError(Exception): pass   234 class ImportWarning(Warning): pass   235 class IndentationError(Exception): pass   236 class IndexError(Exception): pass   237 class KeyError(Exception): pass   238 class KeyboardInterrupt(Exception): pass   239 class LookupError(Exception): pass   240 class MemoryError(Exception): pass   241 class NameError(Exception): pass   242 class NotImplementedError(Exception): pass   243 class OSError(Exception): pass   244 class OverflowError(Exception): pass   245 class PendingDeprecationWarning(Warning): pass   246 class ReferenceError(Exception): pass   247 class RuntimeError(Exception): pass   248 class RuntimeWarning(Warning): pass   249 class StandardError(Exception): pass   250 class StopIteration(Exception): pass   251 class SyntaxError(Exception): pass   252 class SyntaxWarning(Warning): pass   253 class SystemError(Exception): pass   254 class SystemExit(Exception): pass   255 class TabError(Exception): pass   256 class TypeError(Exception): pass   257 class UnboundLocalError(Exception): pass   258 class UnicodeDecodeError(Exception): pass   259 class UnicodeEncodeError(Exception): pass   260 class UnicodeError(Exception): pass   261 class UnicodeTranslateError(Exception): pass   262 class UnicodeWarning(Warning): pass   263 class UserWarning(Warning): pass   264 class ValueError(Exception): pass   265 class ZeroDivisionError(Exception): pass   266    267 # Various types.   268    269 #class ellipsis: pass   270 class NoneType: pass   271 class NotImplementedType: pass   272    273 # General functions.   274 # NOTE: Some of these are actually provided by classes in CPython.   275 # NOTE: We may refuse to support some of these in practice, such as...   276 # NOTE: super, reload.   277    278 def __import__(name, globals=None, locals=None, fromlist=None, level=-1): pass   279 def abs(number): pass   280 def all(iterable): pass   281 def any(iterable): pass   282 def callable(obj): pass   283 def chr(i): pass   284 def classmethod(function): pass   285 def cmp(x, y): pass   286 def compile(source, filename, mode, flags=None, dont_inherit=None): pass   287 def delattr(obj, name): pass   288 def dir(obj=None): pass   289 def divmod(x, y): pass   290 def enumerate(iterable): pass   291 def eval(source, globals=None, locals=None): pass   292 def execfile(filename, globals=None, locals=None): pass   293 def filter(function, sequence): pass   294 def getattr(obj, name, default=None): pass   295 def globals(): pass   296 def hasattr(obj, name): pass   297 def hash(obj): pass   298 def help(*args): pass   299 def hex(number): pass   300 def id(obj): pass   301 def input(prompt=None): pass   302 def isinstance(obj, cls_or_tuple): pass   303 def issubclass(obj, cls_or_tuple): pass   304 def iter(collection_or_callable, sentinel=None): pass   305 def len(obj): pass   306 def locals(): pass   307 def map(function, *args): pass   308 def max(*args): pass   309 def min(*args): pass   310 def oct(number): pass   311 def open(name, mode=None, buffering=None): pass   312 def ord(c): pass   313 def pow(x, y, z=None): pass   314 def property(fget=None, fset=None, fdel=None, doc=None): pass   315 def range(start_or_end, end=None, step=None): pass   316 def raw_input(prompt=None): pass   317 def reduce(function, sequence, initial=None): pass   318 def reload(module): pass   319 def repr(obj): pass   320 def reversed(sequence): pass   321 def round(number, ndigits=None): pass   322 def setattr(obj, name, value): pass   323 def sorted(iterable, cmp=None, key=None, reverse=False): pass   324 def staticmethod(function): pass   325 def sum(sequence, start=0): pass   326 def super(*args): pass   327 def unichr(i): pass   328 def vars(obj=None): pass   329 def zip(*args): pass   330    331 # Reference some names to ensure their existence. This should be everything   332 # mentioned in a get_builtin or load_builtin call. Instances from this module   333 # should be predefined constants.   334    335 function   336 AttributeError   337 StopIteration   338 TypeError   339    340 list   341 tuple   342 #xrange   343 #ellipsis   344 #bool   345    346 # vim: tabstop=4 expandtab shiftwidth=4