It would be nice if dataclasses 
(https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass) 
had an option to make them a sequence.  This would make

dataclass(frozen=True, order=True, sequence=True)

an optionally-typed version of namedtuple.  It would almost totally 
supplant it except that namedtuples have a smaller memory footprint.

sequence would simply inherit from collections.abc.Sequence and implement 
the two methods __len__ and __getitme__.

Best,

Neil
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to