dataclass
inheritance with keyword-only args [3.10]
#1626
Labels
enhancement
New feature or request
fixed in next version (main)
A fix has been implemented and will appear in an upcoming version
Python 3.10 adds the ability to specify keyword-only args in dataclasses. Especially with inheritance, this allows some combinations that would previously have been an error, and are currently still detected as such.
For example, it's now possible to specify fields without a default in a derived class if only keyword-only args in the base class have a default. This will work since keyword-only args need to come after positional/keyword args. https://docs.python.org/3.10/library/dataclasses.html#re-ordering-of-keyword-only-parameters-in-init
At the moment, pylance indicates an error for
z
at position(1)
:--
On a related note, the tip for
D
is also not correct.Due to the reordering it should be
The text was updated successfully, but these errors were encountered: