something like this?
>>> import inspect
>>> import os
>>> print inspect.getsource(os.path.split)
"""Split a pathname.
Perfect, thank you.
Ok, but how can I retrieve information about built-in functions (if any)?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python31\lib\inspect.py", line 439, in getsourcefile
filename = getfile(object)
File "C:\Python31\lib\inspect.py", line 406, in getfile
raise TypeError('arg is a built-in class')
TypeError: arg is a built-in class
To get to the source of functions written in C you have to download the
source distribution, or you can browse the subversion tree:
If you know what module it's in, you can use
But realize that this will only work if the module has been imported,
and might not if the module is implemented in C.
On Windows and I believe other systems, for the stdlib, 'import x'
Not always. For example, os.path is actually in one of ntpath.py,
posixpath.py, or macpath.py.