[issue16837] Number ABC can be instantiated

Raymond Hettinger report at bugs.python.org
Sat Aug 10 01:48:38 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

I looked into this a bit more and don't see another non-invasive way of blocking instantiation.

Marking for Guido to take a look at.  He's the expert on ABCs and typing and is the originator of the __hash__ = None approach to turning off hashability.

Guido, would you like number subclasses to require an override of __hash__ or is the accidental instantiation of Number() something we even care about (I think this unlikely to ever arise in practice)?  My suggestion is to deem it harmless and leave it as is.

----------
assignee: rhettinger -> gvanrossum
nosy: +gvanrossum
versions: +Python 2.7 -Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue16837>
_______________________________________


More information about the Python-bugs-list mailing list