[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread pavel-lexyr
pavel-lexyr added the comment: Thank you all for your input! Migrating the discussion to https://mail.python.org/archives/list/python-id...@python.org/thread/UQRCDWMFNC5NRLLQCTYPOEGWJOIV7BGJ/ for now, if anyone wants to continue. -- resolution: rejected -> _

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread pavel-lexyr
Change by pavel-lexyr : -- resolution: -> rejected ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://m

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Steven, but since I have this typed up I'll post it here. Yes, iterability is another namedtuple feature. Although that would actually be easy to add to dataclasses, so I didn't mention it. I don't really see the point of combining them, except f

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Pavel. Thank you for your submission, but your request is based on a serious misunderstanding of the koan from PEP 20. You might consider that Python has, for example, both for loops and while loops; it has lists and tuples; it has ints and floats and D

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread pavel-lexyr
Change by pavel-lexyr : -- versions: -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker ___ ___ Python

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread pavel-lexyr
pavel-lexyr added the comment: Touche. Another advantage a namedtuple has is that it can expand out of the box - i.e., can write something like > for x, y, z in namedtuple_list: without any list comprehensions. Can we bring those advantages into the dataclass while also preserving the inte

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread Eric V. Smith
Eric V. Smith added the comment: namedtuples have features like true immutability, being smaller, and being faster. -- versions: -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread pavel-lexyr
pavel-lexyr added the comment: Most of the differences are direct upgrades added in the dataclass module. Deprecating dataclass in favour of nametuple would be counterproductive, I agree - what about vice versa? -- ___ Python tracker

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread Eric V. Smith
Eric V. Smith added the comment: They are very different. I don’t see how they could be combined. PEP 557 goes in to some of the differences. -- ___ Python tracker ___ ___

[issue44768] dataclasses.dataclass and collections.namedtuple do the same thing

2021-07-28 Thread pavel-lexyr
New submission from pavel-lexyr : PEP 20 states: > There should be one-- and preferably only one --obvious way to do it. As of right now, two very similar constructions for making a lightweight dataclass exist in Python. collections.namedtuple is one of them. dataclasses.dataclass is the oth