[Neil Girdhar]

> It seems that builtins.bool and numpy.bool_ would both be elements of Boolean

I'd be wary of trying to abstract over `bool` and `numpy.bool_`. There are some 
fundamental differences:

- `bool` subclasses `int`; `numpy.bool_` is not a subclass of any integer type

- moreover, `numpy.bool_` isn't considered integer-like. It _does_ currently 
support `__index__`, but that support is deprecated, so at some point in the 
future a `numpy.bool_` may not be usable in many of the contexts that a Python 
bool is. (cf https://bugs.python.org/issue37980)

- some bitwise operations behave differently: `~False` is not equal to 
`~np.False_`, and similarly for `True`

What's the motivation for this? Is this intended primarily for use in type 
annotations, or did you have some other use in mind?

-- 
Mark
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5H24NXYMFM5NIJ5YMGIH7W5FCLPOCL63/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to