[Tutor] [Fwd: [Fwd: self-modification]]

Alan Gauld alan.gauld at freenet.co.uk
Tue Aug 22 18:10:40 CEST 2006


> Why does the python shell says this:
> 
>>>> print exec.__doc__
>  File "<stdin>", line 1
>    print exec.__doc__
>             ^
> SyntaxError: invalid syntax

exec, like print, is a statement, or command, not a function.

You get the same response if you try

>>> print print.__doc__

or 

>>> help(print)

> While it works with "eval".

eval is a function so has a doc string attached.

Alan G.


More information about the Tutor mailing list