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

Zsiros Levente zslevi at sch.bme.hu
Thu Aug 24 22:12:32 CEST 2006


Alan Gauld wrote:

>
>> 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.

Thanks.


More information about the Tutor mailing list