On Aug 16, 3:25 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Aug 16, 12:50 am, Michele Simionato <[EMAIL PROTECTED]> > wrote:
> > The namedtuple recipe by Raymond Hetting does > > exactly that and, guess what, it uses exec! > > I might be wrong, but the reason namedtuple uses exec is performance. > IIRC earlier versions of the recipe used a metaclass instead, so it's > not that it *has* to use exec, it's just an optimization, totally > justified in this case since namedtuples should be almost as fast as > plain tuples. I always thought the reason for "exec" was having a good signature in the namedtuple constructor. I have not measure performance, though. -- http://mail.python.org/mailman/listinfo/python-list