why does "help(import)" not work?
Diez B. Roggisch
deets at nospam.web.de
Fri Nov 6 05:11:44 EST 2009
Robert P. J. Day schrieb:
> 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?
import is a keyword, so the parser can't comprehend the expression you
created. In the same way it can't do it for
help(class)
or
help(def)
or any other keyword.
Diez
More information about the Python-list
mailing list