Josh Rosenberg added the comment:

Side-note: Some of the objections to a C level namedtuple implementation appear 
to be based on the maintenance hurdle, and other have noted that a 
structseq-based namedtuple might be an option. I have previously attempted to 
write a C replacement for namedtuple that dynamically created a StructSequence. 
I ran into a roadblock due to PyStructSequence_NewType (the API that exists to 
allow creation of runtime defined structseq) being completely broken (#28709).

If the struct sequence API was fixed, it should be a *lot* easier to implement 
a C level namedtuple with minimal work, removing (some) of the maintenance 
objections by simply reducing the amount of custom code involved.

The testnewtype.c code attached to #28709 (that demonstrates the bug) is 66 
lines of code, and implements a basic C level namedtuple creator function (full 
support omitted for brevity, but aside from _source, most of it would be easy). 
I'd expect a finished version to be low three digit lines of custom code, a 
third or less of what the cnamedtuple project needed to write the whole thing 
from scratch.

----------
nosy: +josh.r

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

Reply via email to