[Python-ideas] a new namedtuple
joejev at gmail.com
Mon Jul 17 20:24:37 EDT 2017
If we are worried about speed but want to keep the same API I have a
near drop in replacement for collections.namedtuple that dramatically
improves class and instance creation speed . The only things
missing from this implementation are `_source` and `verbose` which
could be dynamically computed to provide equivalent Python source.
This project was originally proposed as a replacement for the standard
namedtuple, but after talking to Raymond we decided the performance
did not outweigh the simplicity of the existing implementation. Now
that people seem more concerned with performance, I wanted to bring
this up again.
On Mon, Jul 17, 2017 at 8:04 PM, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:
> Just FYI, typing.NamedTuple is there for almost a year and already supports
> default values, methods, docstrings etc.
> Also there is ongoing work towards dataclasses PEP, see
> So that would keep namedtuple API as it is, and focus only on performance
> On 18 July 2017 at 02:01, Ethan Furman <ethan at stoneleaf.us> wrote:
>> Guido has decreed that namedtuple shall be reimplemented with speed in
>> I haven't timed it (I'm hoping somebody will volunteer to be the bench
>> mark guru), I'll offer my NamedTuple implementation from my aenum 
>> library. It uses the same metaclass techniques as Enum, and offers doc
>> string and default value support in the class-based form.
>>  https://pypi.python.org/pypi/aenum/1.4.5
>> Python-ideas mailing list
>> Python-ideas at python.org
>> Code of Conduct: http://python.org/psf/codeofconduct/
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
More information about the Python-ideas