Is this a contradiction in the docs ?
Pierre Barbier de Reuille
pierre.barbier at cirad.fr
Wed Feb 2 09:01:49 EST 2005
Fuzzyman a écrit :
>
>
> Yes.. but that would mean that eval could only run code objects that
> "consist[s] of a single expression".. which I doubt is the reality or
> the intention.
>
> Regards,
> Fuzzyman
> http://www.voidspace.org.uk/python/index.shtml
>
[Sorry, I deleted the commented lines because they were completely
unreadable anyway]
It's exactly what eval is for : evaluate a single expression and return
its result ! Try with strings : you can't even evaluate a statement !
You can only evaluate an expression !
And what would be the return result of a sequence of statement ?
If you want to execute a sequence, you want to use exec, not eval ...
Pierre
More information about the Python-list
mailing list