"help( pi )"

Chris Angelico rosuav at gmail.com
Fri Nov 17 21:45:13 EST 2017


On Sat, Nov 18, 2017 at 10:35 AM, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Dennis Lee Bieber <wlfraed at ix.netcom.com> writes:
>>should
>>               help(3.1415926536)      #or whatever precision is used in module math
>>produce anything?
>
>   That question made me try something else whose output
>   surprises me:
>
> |Python 3.7.0 ...
> |>>> help( 'math.pi' )
> |Help on float in math object:
> |
> |math.pi = class float(object)
> | |  math.pi(x=0, /)
> | |
> | |  Convert a string or number to a floating point number, if possible.
> | |...

Yes, that's correct; it's critical for anything that's a keyword (eg
help("if")), but legal for others. And it can have the side-effect of
importing and caching a module.

ChrisA



More information about the Python-list mailing list