Zaur Shibzukhov wrote: > `Recordclass` is defined on top of` memoryslots` just like `namedtuple` > above` tuple`. Attributes are accessed via a descriptor (`itemgetset`), > which supports both` __get__` and `__set__` by the element index. > > As a result, `recordclass` takes up as much memory as` namedtuple`, it > supports quick access by `__getitem__` /` __setitem__` and by attribute > name via the protocol of the descriptors.
I'm not sure why you need a new C-level type for this. Couldn't you get the same effect just by using __slots__? e.g. class C: __slots__ = ('attr_1', ..., 'attr_m') def __new __ (cls, attr_1, ..., attr_m): self.attr_1 = attr_1 ... self.attt_m = attr_m -- Greg _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/