New submission from Adrian Stachlewski <[email protected]>:
I've tried to declare two classes
@dataclass
class Base:
__slots__ = ('x',)
x: Any
@dataclass
class Derived(Base):
x: int
y: int
As long as I correctly understood PEP 557 (inheritance part), changing type of
variable is possible. This code produce error:
TypeError: non-default argument 'y' follows default argument
'x' variable in Derived class has changed default from MISSING to
member_descriptor and that's the reason of the exception.
----------
components: Library (Lib)
messages: 314077
nosy: stachel
priority: normal
severity: normal
status: open
title: dataclasses and __slots__ - non-default argument (member_descriptor)
type: behavior
versions: Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33100>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com