Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

namedtuple is much faster now that four years ago. New namedtuple type 
creation, instantiating a namedtuple object, access to its members -- all this 
is times faster. It is still slower than tuple in some aspects, because tuples 
are everywere and the interpreter has special optimizations for tuples. But 
date.isocalendar() is not used in such performance critical code.

The size of pickles will grow, the time of pickling and unpickling will 
increase, and old Python versions will not be able to unpickle a new type by 
default. But I do not think that instances of this type will be pickled in 
large numbers so it will has a global effect, and the problem with 
compatibility can be solved with some hacks. If anybody pickles them at all.

It was not clear whether adding a new type will give any benefit in real code. 
Thanks to Paul for his investigations.

The only thing that makes this case unique is that we have two implementations 
of the datetime module. Therefore we will need either add two implementation of 
a new named tuple type (which are different in details) or import the Python 
implementation into the C code. This increases the cost of the implementation 
and maintaining.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue24416>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to