[Python-Dev] issue5578 - explanation
"Martin v. Löwis"
martin at v.loewis.de
Sat Apr 4 04:07:34 CEST 2009
Alexandre Vassalotti wrote:
> On Tue, Mar 31, 2009 at 11:25 PM, Guido van Rossum <guido at python.org> wrote:
>> Well hold on for a minute, I remember we used to have an exec
>> statement in a class body in the standard library, to define some file
>> methods in socket.py IIRC.
>
> FYI, collections.namedtuple is also implemented using exec.
Ah, but it uses "exec ... in ...". That is much safer than an
unqualified exec (where the issue is what namespace it executes in,
and, consequentially, what early binding is possible).
The patch bans only unqualified exec, IIUC.
Regards,
Martin
More information about the Python-Dev
mailing list