This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andrei.avk
Recipients andrei.avk, eric.smith, simple_coder878, sobolevn
Date 2021-11-08.01:28:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636334882.59.0.183965423507.issue45366@roundup.psfhosted.org>
In-reply-to
Content
I think a good possible solution is to raise an error if `default_factory` is provided on a `init=False` dataclass that doesn't have a `__init__()` defined. However, it will create a slight inconsistency because there will be an error when `__init__` is not defined, but no error otherwise -- to allow calling the factory in custom defined `__init__()`.

The error would be "Error: default_factory argument needs `init=True` to be set on dataclass because default_factory value is created in the generated __init__() method".
History
Date User Action Args
2021-11-08 01:28:02andrei.avksetrecipients: + andrei.avk, eric.smith, sobolevn, simple_coder878
2021-11-08 01:28:02andrei.avksetmessageid: <1636334882.59.0.183965423507.issue45366@roundup.psfhosted.org>
2021-11-08 01:28:02andrei.avklinkissue45366 messages
2021-11-08 01:28:02andrei.avkcreate