Rémi Lapeyre <[email protected]> added the comment:
I think this is what is referring Кирилл Чуркин to:
Python 3.7.2 (default, Jan 13 2019, 12:50:01)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from dataclasses import dataclass
>>> @dataclass
... class Parent:
... x: int = 1
...
>>> Parent()
Parent(x=1)
>>> @dataclass
... class Child(Parent):
... y: int
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
line 991, in dataclass
return wrap(_cls)
File
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
line 983, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
File
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
line 904, in _process_class
else 'self',
File
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
line 490, in _init_fn
raise TypeError(f'non-default argument {f.name!r} '
TypeError: non-default argument 'y' follows default argument
@eric.smith, do you think Child's argument should be merged nicely with
Parent's ones in this case? If so, can I propose a PR?
----------
nosy: +remi.lapeyre
_______________________________________
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