[issue4998] __slots__ on Fraction is useless

Jeffrey Yasskin report at bugs.python.org
Tue Jan 20 20:55:18 CET 2009


Jeffrey Yasskin <jyasskin at gmail.com> added the comment:

Rational has default definitions for some of its methods and properties.
If Fraction inherits from Rational, it gets those definitions
implicitly. If it's registered with Rational, it has to define them itself.

I don't know that much about __slots__ (or I'd have known that just
defining it on Fraction wouldn't work :-/) but if it doesn't prevent
subclasses from having dicts, it seems like a good idea to add an empty
__slots__ to most classes in the ABC hierarchy, and definitely the
numeric ones.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4998>
_______________________________________


More information about the Python-bugs-list mailing list