[Python-ideas] namedtuple baseclass
Yury Selivanov
yselivanov.ml at gmail.com
Sun Jan 12 22:58:19 CET 2014
Raymond,
On January 12, 2014 at 3:01:42 PM, Raymond Hettinger (raymond.hettinger at gmail.com) wrote:
>
>
> On Jan 11, 2014, at 11:04 PM, Yury Selivanov
> wrote:
>
> > I propose to add a baseclass for all namedtuples. Right now 'namedtuple'
> > function dynamically creates a class derived from 'tuple',
> which complicates
> > things like dynamic dispatch.
>
> A named tuple is a protocol, not a class.
This line actually makes a lot of sense, thank you for the explanation.
Since it’s a protocol, and a widely used one, then how about reopening a
discussion (started in #7796) on adding an ABC ‘collections.abc.NamedTuple’?
I understand the issue with structseq, but we can have the ABC now for
regular named tuples. If/Once the named tuple API is implemented for
structseqs, it will automatically conform to the proposed ABC.
Thank you,
Yury
More information about the Python-ideas
mailing list