[Python-ideas] a new namedtuple
mertz at gnosis.cx
Tue Jul 18 00:06:05 EDT 2017
Can you try across a range of tuple sizes? E.g. what about with 100 items?
On Jul 17, 2017 7:56 PM, "Ethan Furman" <ethan at stoneleaf.us> wrote:
On 07/17/2017 06:34 PM, Steven D'Aprano wrote:
> On Mon, Jul 17, 2017 at 05:01:58PM -0700, Ethan Furman wrote:
Guido has decreed that namedtuple shall be reimplemented with speed in mind.
>> I haven't timed it (I'm hoping somebody will volunteer to be the bench
>> guru), I'll offer my NamedTuple implementation from my aenum  library.
> With respect Ethan, if you're going to offer up NamedTuple as a faster
> version of namedtuple, you should at least do a quick proof of
> concept to demonstrate that it actually *is* faster.
I suck at benchmarking, so thank you for providing those quick-and-dirty
Full bench marking
> can wait, but you should be able to do at least something like:
> python3 -m timeit --setup "from collections import namedtuple" \
> "K = namedtuple('K', 'a b c')"
> python3 -m timeit --setup "from aenum import NamedTuple" \
> "K = NamedTuple('K', 'a b c')"
So it seems to be faster! :)
It is also namedtuple compatible, except for the _source attribute.
Python-ideas mailing list
Python-ideas at python.org
Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas