[Python-ideas] Fwd: Anonymous namedtuples

João Bernardo jbvsmo at gmail.com
Tue Apr 19 12:58:47 EDT 2016

On Tue, Apr 19, 2016 at 12:06 PM, Guido van Rossum <guido at python.org> wrote:

> Every call to namedtuple() creates a new class, which is a very expensive
> operation. On my machine the simplest namedtuple call taks around 350 usec.

Isn't that because the code for namedtuple is using exec instead a more
pythonic approach of metaclassing to make it "faster" but taking longer to
actually create the class?

Maybe instead of changing namedtuple (which seems to be a taboo), there
could be a new anonymous type. Something built-in, with its own syntax
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160419/48c63cba/attachment-0001.html>

More information about the Python-ideas mailing list