[Python-ideas] namedtuple redesign goals
Ethan Furman
ethan at stoneleaf.us
Mon Jul 24 07:02:33 EDT 2017
On 07/23/2017 10:47 AM, Michel Desmoulin wrote:
> I'm not sure why everybody have such a grip on the type.
If I understand the goal of "a new namedtuple" correctly, it is not to come up with yet another namedtuple type -- it is
to make the existing collections.namedtuple a faster experience, and possibly add another way to create such a thing.
This means that the "replacement" namedtuple MUST be backwards compatible with the existing collections.namedtuple, and
keeping track of type is one of the things it does:
--> from collections import namedtuple
--> Point = namedtuple('Point', 'x y')
--> p1 = Point(3, 7)
--> p1.x
3
--> p1.y
7
--> isinstance(p1, Point)
True
--
~Ethan~
More information about the Python-ideas
mailing list