On Fri, Aug 10, 2018 at 04:01:59PM -0700, Neil Girdhar wrote: > It would be nice if dataclasses > (https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass) > had an option to make them a sequence.
Do you have a use-case or reason for this other than "it would be nice"? Nice in what way? We already have namedtuple, and for backwards compatibility if no other reason it won't be going away. What benefit do we get from allowing dataclasses to do what namedtuple already does? You already mentioned one disadvantage: namedtuple is much more memory efficient. What corresponding benefit do you see? Dataclass already supports explicit conversion to tuples and dicts. What use-cases for sequence-ness don't they support? Conceptually, I think of dataclasses as a record or a struct, not as a sequence. (I'll admit that I think of namedtuples the same way, and almost never make use of their tuple-ness.) I would find it strange for dataclass to support a sequence API out of the box. -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/