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.