On Thu, Jul 29, 2021 at 9:07 AM <[email protected]> wrote: > > [Migrating the discussion from https://bugs.python.org/issue44768.] > > PEP 20 says: > > > There should be one-- and preferably only one --obvious way to do it. > > There are two ways to create a simple named type to store data: > collections.namedtuple and dataclasses.dataclass. I propose deprecating > namedtuple. > > As far as the interface is concerned, the namedtuple is almost completely > equivalent to a frozen dataclass - with some iterability syntactic sugar > thrown in. I don't think there are use cases for namedtuple that would not be > trivial to rewrite with dataclasses. >
A namedtuple is fundamentally a tuple. A dataclass isn't. There are times when each one should be used. What's the justification for removing one of them? ChrisA _______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/KB4ABNE3XXCP6KMHQFR6YUPOIREOJLGZ/ Code of Conduct: http://python.org/psf/codeofconduct/
