Josh Rosenberg <shadowranger+pyt...@gmail.com> added the comment:

First off, link to discussion: 
https://groups.google.com/d/topic/python-ideas/-3QW3cxj3ko/discussion

1. bool is already a virtual subclass of Integral since it's an actual subclass 
of int (which is a virtual subclass of Integral); no need to explicitly 
register it

2. Don't try to register numpy's types for them; doing so would mean simply 
having numpy installed forces it to be imported if you import numbers, even if 
your script never uses numpy. Let numpy add registration for the type itself.

3. If Boolean is not a subclass of Integer/Integral, why is it in the numbers 
module at all? The discussion seemed to suggest putting it in numbers when the 
idea was that Boolean would subclass Integer/Integral; if it's not numeric at 
all, then the numbers module doesn't make sense.

4. Obviously, it's impossible to overload the not behavior (__bool__ is called 
directly to get a true bool, then the result is inverted, there is no special 
method for handling the not keyword), so it looks like the proposal is to make 
__invert__ part of the interface. Except bool itself doesn't behave in a way 
that would make __invert__ make sense as a drop in substitution for not; ~True 
produces -2, ~False produces -1, in neither case does it produce a bool result, 
and the result is always truthy. Changing this is impractical, since it would 
violate the int-like behavior of bool (which has been a historical guarantee).

----------
nosy: +josh.r

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32886>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to