Clarification about PEP 681 statement

Hello, I'm reading over PEP 681, and it says here (https://www.python.org/dev/peps/pep-0681/#kw-only-field-descriptor-parameter) that "The attrs library supports a kw_only parameter for individual fields. We chose not to support a kw_only parameter, since it is specific to attrs." Am I misunderstanding this? In Python 3.10, we can do `dataclasses.field(kw_only=True)`. Thanks, Neil

Thanks for catching this Neil! I'll fix the PEP to support a kw_only field descriptor parameter. The original dataclass_transform spec was written before bpo 43532 [1], and apparently we missed this when updating the spec to reflect that change. I should also update the PEP to mention match_args and slots (also new in 3.10), and to explain that some dataclasses.field() parameters (ex. hash, compare) are omitted intentionally because they have no impact on type checking. More generally, I'm now wondering how the PEP should reflect our intention that dataclass_transform will support future dataclass behaviors (as appropriate). Thanks again! -Erik [1] https://bugs.python.org/issue43532 -----Original Message----- From: Neil Girdhar <mistersheik@gmail.com> Sent: Saturday, February 26, 2022 12:06 AM To: typing-sig@python.org Subject: [Typing-sig] Clarification about PEP 681 statement Hello, I'm reading over PEP 681, and it says here (https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.python...) that "The attrs library supports a kw_only parameter for individual fields. We chose not to support a kw_only parameter, since it is specific to attrs." Am I misunderstanding this? In Python 3.10, we can do `dataclasses.field(kw_only=True)`. Thanks, Neil _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.pytho... Member address: erik.debonte@microsoft.com

Thanks for catching this Neil! I'll fix the PEP to support a kw_only field descriptor parameter. The original dataclass_transform spec was written before bpo 43532 [1], and apparently we missed this when updating the spec to reflect that change. I should also update the PEP to mention match_args and slots (also new in 3.10), and to explain that some dataclasses.field() parameters (ex. hash, compare) are omitted intentionally because they have no impact on type checking. More generally, I'm now wondering how the PEP should reflect our intention that dataclass_transform will support future dataclass behaviors (as appropriate). Thanks again! -Erik [1] https://bugs.python.org/issue43532 -----Original Message----- From: Neil Girdhar <mistersheik@gmail.com> Sent: Saturday, February 26, 2022 12:06 AM To: typing-sig@python.org Subject: [Typing-sig] Clarification about PEP 681 statement Hello, I'm reading over PEP 681, and it says here (https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.python...) that "The attrs library supports a kw_only parameter for individual fields. We chose not to support a kw_only parameter, since it is specific to attrs." Am I misunderstanding this? In Python 3.10, we can do `dataclasses.field(kw_only=True)`. Thanks, Neil _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.pytho... Member address: erik.debonte@microsoft.com
participants (2)
-
Erik De Bonte
-
Neil Girdhar