Where is the help function defined?
Thomas Jollans
thomas at jollans.com
Mon Jun 21 13:37:27 EDT 2010
On 06/21/2010 07:17 PM, Peng Yu wrote:
> help(help) gives me the following explanation.
>
> [snip]
>
> I then looked at pydoc site. But I don't see an entry on help(). How
> to figure out where help() (or a function in general) is defined?
>>> type(dir)
<class 'builtin_function_or_method'>
>>> type(help)
<class 'site._Helper'>
>>>
help is not a function, it's an instance of site._Helper. It just
"feels" like a function by being callable.
You could create your own "help" callable simply by using the _Helper
contructor:
>>> import site
>>> help2 = site._Helper()
>>>
-- Thomas
More information about the Python-list
mailing list