New submission from Кирилл Чуркин <[email protected]>:
I found a problem when use inherit dataclasses.
When I define parent dataclass with field(s) with default (or default_factory)
properties, and inherit child dataclass from parent, i define non-default field
in it and got `TypeError('non-default argument {f.name!r} follows default
argument')` in dataclasses.py(466)._init_fn. It happens because dataclass
constructor defines all parent class fields as arguments in __init__ class and
then all child class fields.
Maybe it need to define all non-default fields in init before all default.
----------
messages: 336297
nosy: Кирилл Чуркин
priority: normal
severity: normal
status: open
title: Inheritance dataclasses fields and default init statement
type: behavior
versions: Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36077>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com