[issue23910] C implementation of namedtuple (WIP)

Raymond Hettinger report at bugs.python.org
Wed Apr 29 18:26:07 CEST 2015


Raymond Hettinger added the comment:

>  0.0699 usec per loop --> 0.0468 

That's pretty good for a small patch :-)


For the pre-computed 1-tuple, I think you need to check for a refcnt of 1 and fallback to PyTuple_New if the tuple is in use (i.e. a property that calls another property).  See Objects/enumobject.c::105 for an example.

Also, consider providing a way to clean-up that tuple on shutdown.  For example, look at what is done with the various freelists.  An easier way is to make the premade tuple part of the property object struct so that it gets freed when the property is deallocated.

Adding Serhiy to the nosy list, he can help with cleaning-up the patch so that it is ready to apply.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23910>
_______________________________________


More information about the Python-bugs-list mailing list