simplemente puede usar el comando help()
para obtener ayuda acerca de funciones incorporadas, así como su código.
por ejemplo: si desea ver el código de str(), simplemente escriba - help(str)
volverá así,
>>> help(str)
Help on class str in module __builtin__:
class str(basestring)
| str(object='') -> string
|
| Return a nice string representation of the object.
| If the argument is a string, the return value is the same object.
|
| Method resolution order:
| str
| basestring
| object
|
| Methods defined here:
|
| __add__(...)
| x.__add__(y) <==> x+y
|
| __contains__(...)
| x.__contains__(y) <==> y in x
|
| __eq__(...)
| x.__eq__(y) <==> x==y
|
| __format__(...)
| S.__format__(format_spec) -> string
|
| Return a formatted version of S as described by format_spec.
|
| __ge__(...)
| x.__ge__(y) <==> x>=y
|
| __getattribute__(...)
-- More --
¿Puedes dar un ejemplo con 'enumerate'? – Benjamin
Puede ver la forma en que el enumerado incorporado se prueba [aquí] (http://hg.python.org/cpython/file/b36cb4602e21/Lib/test/test_enumerate.py). – Makoto
el código de enumeración es [aquí] (http://svn.python.org/view/python/trunk/Objects/enumobject.c?view=markup) –