Andrei Kulakov <andrei....@gmail.com> added the comment:
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". ---------- nosy: +andrei.avk _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45366> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com