[Python-Dev] A "record" type (was Re: Py2.6 ideas)
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Feb 21 23:41:07 CET 2007
Josiah Carlson wrote:
> Somewhere in the back of my mind something is telling me - if you can
> get a tuple with attributes based on __slots__, you just duplicate the
> references as both an attribute AND in the standard tuple PyObject*
> array,
It should be possible to start with a tuple subclass and
add descriptors to provide named access. If the descriptor
is implemented in C it should be just as efficient as
using __slots__, but with no duplication of the references.
Given a suitable descriptor type, it shouldn't be hard to
write a factory function to assemble such classes.
--
Greg
More information about the Python-Dev
mailing list