<div dir="ltr">Increasingly, NumPy does not considers booleans to be integer types, and indexing is one of these cases.<div><br></div><div>So no, it will not be treated as a tuple of integers, but as a 0d mask<div><br></div><div>Eric</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, 13 Dec 2017 at 12:44 Joe <<a href="mailto:solarjoe@posteo.org">solarjoe@posteo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
yet another question.<br>
<br>
I looked through the indexing rules in the<br>
documentation but I count not find which one<br>
applies to x[True] and x[False]<br>
<br>
that might e.g result from<br>
<br>
import numpy as np<br>
x = np.array(3)<br>
x[x>5]<br>
x[x<1]<br>
x[True]<br>
x[False]<br>
<br>
x = np.random.rand(2,3)<br>
x[x>5]<br>
x[x<1]<br>
x[True]<br>
x[False]<br>
<br>
I understood that they are equivalent to<br>
<br>
x[(False,)]<br>
<br>
I tested it and it looks like advanced indexing,<br>
but I try to unterstand the logic behind this,<br>
if there is any :)<br>
<br>
In x[x<1] the x<1 is a mask and thus I guess it is a<br>
"tuple with at least one sequence object or ndarray (of data type<br>
integer or bool)", right?<br>
<br>
Or will x[True] trigger basic indexing as it is "a tuple of integers"<br>
because True will be converted to Int?<br>
<br>
Cheers,<br>
Joe<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@python.org" target="_blank">NumPy-Discussion@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>