[New-bugs-announce] [issue33100] dataclasses and __slots__ - non-default argument (member_descriptor)
Adrian Stachlewski
report at bugs.python.org
Sun Mar 18 23:30:15 EDT 2018
New submission from Adrian Stachlewski <adrian.stachlewski at gmail.com>:
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 <report at bugs.python.org>
<https://bugs.python.org/issue33100>
_______________________________________
More information about the New-bugs-announce
mailing list