[Python-ideas] a new namedtuple

Guido van Rossum guido at python.org
Tue Jul 18 19:20:23 EDT 2017


On Tue, Jul 18, 2017 at 3:18 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> Ethan Furman wrote:
>
>> I certainly don't expect the signature to change, but why is using a
>> metaclass out?  The use (or not) of a metaclass /is/ an implementation
>> detail.
>>
>
> For me, the main benefit of using a metaclass would be that
> it enables using normal class declaration syntax to define a
> namedtuple. That's not just an implementation detail!


Newer versions of the typing module do this:
https://docs.python.org/3/library/typing.html#typing.NamedTuple (and indeed
it's done with a metaclass).

-- 
--Guido van Rossum (python.org/~guido <http://python.org/%7Eguido>)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170718/264c0c55/attachment.html>


More information about the Python-ideas mailing list