Add frozen_default
parameter on dataclass_transform
· Issue #99957 · python/cpython (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Feature or enhancement
Add a new frozen_default
parameter to dataclass_transform similar to the existing eq_default
and order_default
parameters.
Pitch
- Frozen dataclasses are very popular when working with Jax (
flax.struct.dataclass
andtjax.dataclass
), so being able to indicate that they are frozen by default would improve the user experience. dataclass_transform
is currently supported by Pyright/Pylance and Pyre. Both teams are in favor of implementing this new parameter. Sincedataclass_transform
supports kwargs for experimentation/extensibility, Pyright was already able to add support forfrozen_default
.- All feedback on typing-sig has been in favor of this enhancement.
Previous discussion
Discussed in typing-sig.