On Thu, Feb 27, 2014 at 12:15 AM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> py> def spam():
> ...     exec( """x = 23""" )
> ...     return x
> ...
> py> spam()
> 23
>
>
> (My real example is more complex than this.)
>
> According to the documentation of exec, I don't think this should
> actually work, and yet it appears to.

Doesn't work for me, in IDLE in 3.4.0b2, nor in command-line Python on
3.4.0rc1+ (from hg a couple of weeks ago). But it did (happen to?)
work in 2.7. What version did you use?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to