[issue45531] field "mro" behaves strangely in dataclass
Eric V. Smith
report at bugs.python.org
Wed Oct 20 10:06:40 EDT 2021
Eric V. Smith <eric at trueblade.com> added the comment:
I think the only other thing that could be done is to have a special test for "default is type.mro", and if so, don't assume it's a default value. Which means that you could never actually use:
@dataclass
class A:
mro: object = type.mro
But it's probably best to just disallow a field named "mro". Which is unfortunate, but such is life. It's a shame mro isn't a builtin, so we could do mro(A) instead of A.mro().
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45531>
_______________________________________
More information about the Python-bugs-list
mailing list