Peter Dembinski wrote: > AFAIK inc is builtin function. And builtin functions doesn't have to > be real functions, they can be just aliases to Python's VM bytecodes > or sets of bytecodes.
Wrong on both counts. ;) py> inc Traceback (most recent call last): File "<interactive input>", line 1, in ? NameError: name 'inc' is not defined py> __builtins__.inc Traceback (most recent call last): File "<interactive input>", line 1, in ? AttributeError: 'module' object has no attribute 'inc' There is no builtin 'inc'. To verify, check: http://docs.python.org/lib/built-in-funcs.html http://docs.python.org/lib/non-essential-built-in-funcs.html And while builtin functions may not have to be real *functions*, they do have to be real *callables*: py> type(abs) <type 'builtin_function_or_method'> py> help(type(abs)) Help on class builtin_function_or_method in module __builtin__: class builtin_function_or_method(object) | Methods defined here: | | __call__(...) | x.__call__(...) <==> x(...) ... py> type(bool) <type 'type'> py> help(type(bool)) Help on class type in module __builtin__: class type(object) | type(object) -> the object's type | type(name, bases, dict) -> a new type | | Methods defined here: | | __call__(...) | x.__call__(...) <==> x(...) ... Note that both <type 'builtin_function_or_method'> and <type 'type'> have a __call__ method, which means they are callable objects. They're not just bytecodes; they're real objects, just like everything else in Python. =) STeVe -- http://mail.python.org/mailman/listinfo/python-list