Zsiros Levente wrote:
> Why does the python shell says this:
>
>   
>>>> print exec.__doc__
>>>>         
>   File "<stdin>", line 1
>     print exec.__doc__
>              ^
> SyntaxError: invalid syntax
>
>
> While it works with "eval".

exec is a statement that is interpreted by the compiler and compiled to 
byte code. There is no 'exec' object. OTOH eval is a function in the 
built-in namespace, so there is an 'eval' object and you can look at its 
attributes, including its doc string.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to