<div dir="auto"><div>NumPy np.bool_ is specifically not a subclass of any np.int_.  If it we're, there would be an ambiguity between indexing with a Boolean array and an array of ints. Both are meaningful, but they mean different things (mask vs collection of indices).</div><div dir="auto"><br></div><div dir="auto">Do we have other examples a Python ABC that exists to accommodate something outside the standard library or builtins? Even if not, NumPy is special... the actual syntax for '@' exists primarily for that library!<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Feb 12, 2018 5:51 AM, "Steven D'Aprano" <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Mon, Feb 12, 2018 at 09:41:04AM +0000, Sylvain MARIE wrote:<br>
<br>
> The numbers module provides very useful ABC for the 'numeric tower',<br>
> able to abstract away the differences between python primitives and<br>
> for example numpy primitives.<br>
> I could not find any equivalent for Booleans.<br>
> However numpy defines np.bool too, so being able to have an abstract<br>
> Boolean class for both python bool and numpy bool would be great.<br>
<br>
</div>I don't know anything about numpy bools, but Python built-in bools are<br>
numbers, and as such already have an ABC: they are a subclass of int.<br>
<font color="#888888"><br>
<br>
<br>
--<br>
Steve<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</font></blockquote></div><br></div></div></div>