why does "help(import)" not work?

Brian Quinlan brian at sweetapp.com
Fri Nov 6 05:14:02 EST 2009


Hi Robert,

help() is just a regular function that must be called with correct  
Python syntax and the import keyword is not allowed in an argument list.

The correct syntax is:
help('import')

Cheers,
Brian

On 6 Nov 2009, at 20:56, Robert P. J. Day wrote:

>
>  i'm sure there's a painfully obvious answer to this, but is there a
> reason i can't do:
>
>>>> help(import)
>  File "<stdin>", line 1
>    help(import)
>              ^
> SyntaxError: invalid syntax
>>>>
>
>  on the other hand, i can certainly go into "help()" and type
> "import" to get that help.  it seems counter-intuitive to have the
> first variation fail but the second succeed.
>
>  what is the rule for this in python3?
>
> rday
> --
>
>
> = 
> = 
> ======================================================================
> Robert P. J. Day                               Waterloo, Ontario,  
> CANADA
>
>            Linux Consulting, Training and Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> = 
> = 
> ======================================================================
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list