Could we add frozen_default to "PEP 681 – Data Class Transforms"?
The parameters provide various defaults: https://peps.python.org/pep-0681/#dataclass-transform-parameters However, frozen dataclasses are very popular when working with Jax (flax.struct.dataclass, and tjax.dataclass). Could we add `frozen_default` analogous to the other defaulted parameters?
I think this is a reasonable extension. It can be added in a way that's backward compatible with the Python 3.11 typing module and the typing_extensions library because `dataclass_transform` has a `**kwargs` parameter. This would simply require an update to the documentation and an agreement among the type checker maintainers. I don't think mypy or pytype have implemented support for `dataclass_transform` yet, so it would just be pyre and pyright that would be affected. I'm willing to add it to pyright if there are no objections and the pyre maintainers are open to making the change. -Eric -- Eric Traut Contributor to Pyright & Pylance Microsoft
+1 to this, I would find frozen_default useful On Wed, 30 Nov 2022 at 21:19, Eric Traut <eric@traut.com> wrote:
I think this is a reasonable extension. It can be added in a way that's backward compatible with the Python 3.11 typing module and the typing_extensions library because `dataclass_transform` has a `**kwargs` parameter. This would simply require an update to the documentation and an agreement among the type checker maintainers.
I don't think mypy or pytype have implemented support for `dataclass_transform` yet, so it would just be pyre and pyright that would be affected.
I'm willing to add it to pyright if there are no objections and the pyre maintainers are open to making the change.
-Eric
-- Eric Traut Contributor to Pyright & Pylance Microsoft _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: hauntsaninja@gmail.com
Sounds good to me. I can make the docs and `typing_extensions` changes. Should it also be added into `typing` immediately? Are there any other `foo_default` parameters that anyone thinks should be added while we’re at it? There was a brief discussion about `init_default` [1] a while back, but the user didn’t seem committed to the idea. -Erik [1] https://github.com/microsoft/pylance-release/issues/2494#issuecomment-107412... From: Shantanu Jain <hauntsaninja@gmail.com> Sent: Wednesday, November 30, 2022 11:10 PM To: Eric Traut <eric@traut.com> Cc: typing-sig@python.org Subject: [Typing-sig] Re: Could we add frozen_default to "PEP 681 – Data Class Transforms"? You don't often get email from hauntsaninja@gmail.com<mailto:hauntsaninja@gmail.com>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification> +1 to this, I would find frozen_default useful On Wed, 30 Nov 2022 at 21:19, Eric Traut <eric@traut.com<mailto:eric@traut.com>> wrote: I think this is a reasonable extension. It can be added in a way that's backward compatible with the Python 3.11 typing module and the typing_extensions library because `dataclass_transform` has a `**kwargs` parameter. This would simply require an update to the documentation and an agreement among the type checker maintainers. I don't think mypy or pytype have implemented support for `dataclass_transform` yet, so it would just be pyre and pyright that would be affected. I'm willing to add it to pyright if there are no objections and the pyre maintainers are open to making the change. -Eric -- Eric Traut Contributor to Pyright & Pylance Microsoft
El jue, 1 dic 2022 a las 12:58, Erik De Bonte (<Erik.DeBonte@microsoft.com>) escribió:
Sounds good to me. I can make the docs and `typing_extensions` changes. Should it also be added into `typing` immediately?
We can add it to typing for Python 3.12, not for 3.11 and earlier versions.
Are there any other `foo_default` parameters that anyone thinks should be added while we’re at it? There was a brief discussion about `init_default` [1] a while back, but the user didn’t seem committed to the idea.
-Erik
[1] https://github.com/microsoft/pylance-release/issues/2494#issuecomment-107412...
*From:* Shantanu Jain <hauntsaninja@gmail.com> *Sent:* Wednesday, November 30, 2022 11:10 PM *To:* Eric Traut <eric@traut.com> *Cc:* typing-sig@python.org *Subject:* [Typing-sig] Re: Could we add frozen_default to "PEP 681 – Data Class Transforms"?
You don't often get email from hauntsaninja@gmail.com. Learn why this is important <https://aka.ms/LearnAboutSenderIdentification>
+1 to this, I would find frozen_default useful
On Wed, 30 Nov 2022 at 21:19, Eric Traut <eric@traut.com> wrote:
I think this is a reasonable extension. It can be added in a way that's backward compatible with the Python 3.11 typing module and the typing_extensions library because `dataclass_transform` has a `**kwargs` parameter. This would simply require an update to the documentation and an agreement among the type checker maintainers.
I don't think mypy or pytype have implemented support for `dataclass_transform` yet, so it would just be pyre and pyright that would be affected.
I'm willing to add it to pyright if there are no objections and the pyre maintainers are open to making the change.
-Eric
-- Eric Traut Contributor to Pyright & Pylance Microsoft
+1 from Pyre. This sounds like a reasonable change. On Wed, Nov 30, 2022 at 9:19 PM Eric Traut <eric@traut.com> wrote:
I think this is a reasonable extension. It can be added in a way that's backward compatible with the Python 3.11 typing module and the typing_extensions library because `dataclass_transform` has a `**kwargs` parameter. This would simply require an update to the documentation and an agreement among the type checker maintainers.
I don't think mypy or pytype have implemented support for `dataclass_transform` yet, so it would just be pyre and pyright that would be affected.
I'm willing to add it to pyright if there are no objections and the pyre maintainers are open to making the change.
-Eric
-- Eric Traut Contributor to Pyright & Pylance Microsoft _______________________________________________ Typing-sig mailing list -- typing-sig@python.org To unsubscribe send an email to typing-sig-leave@python.org https://mail.python.org/mailman3/lists/typing-sig.python.org/ Member address: gohanpra@gmail.com
-- S Pradeep Kumar
Great. Sounds like there are no objections. I've added the logic for `frozen_default` in pyright, and this will be included in the next week's release. -Eric -- Eric Traut Contributor to Pyright & Pylance Microsoft
`frozen_default` has been added to both typing and typing_extensions, pending future releases of each. https://github.com/python/cpython/pull/99958 https://github.com/python/typing_extensions/pull/101 -Erik From: S Pradeep Kumar <gohanpra@gmail.com> Sent: Friday, December 2, 2022 10:30 AM To: Eric Traut <eric@traut.com> Cc: typing-sig@python.org Subject: [Typing-sig] Re: Could we add frozen_default to "PEP 681 – Data Class Transforms"? +1 from Pyre. This sounds like a reasonable change. On Wed, Nov 30, 2022 at 9:19 PM Eric Traut <eric@traut.com<mailto:eric@traut.com>> wrote: I think this is a reasonable extension. It can be added in a way that's backward compatible with the Python 3.11 typing module and the typing_extensions library because `dataclass_transform` has a `**kwargs` parameter. This would simply require an update to the documentation and an agreement among the type checker maintainers. I don't think mypy or pytype have implemented support for `dataclass_transform` yet, so it would just be pyre and pyright that would be affected. I'm willing to add it to pyright if there are no objections and the pyre maintainers are open to making the change. -Eric -- Eric Traut Contributor to Pyright & Pylance Microsoft _______________________________________________ Typing-sig mailing list -- typing-sig@python.org<mailto:typing-sig@python.org> To unsubscribe send an email to typing-sig-leave@python.org<mailto:typing-sig-leave@python.org> https://mail.python.org/mailman3/lists/typing-sig.python.org/<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.python.org%2Fmailman3%2Flists%2Ftyping-sig.python.org%2F&data=05%7C01%7Cerik.debonte%40microsoft.com%7Cfb14cbd1354441e7f17308dad4935898%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638056026567205393%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=p4Vg1D%2BiVvdxAUMDnO9Kr85rUMnEcAhAqGmo%2BqG5s%2FU%3D&reserved=0> Member address: gohanpra@gmail.com<mailto:gohanpra@gmail.com> -- S Pradeep Kumar
participants (6)
-
Eric Traut
-
Erik De Bonte
-
Jelle Zijlstra
-
Neil Girdhar
-
S Pradeep Kumar
-
Shantanu Jain