[Numpy-discussion] Advanced indexing: "fancy" vs. orthogonal
Benjamin Root
ben.root at ou.edu
Thu Apr 2 14:59:10 EDT 2015
The distinction that boolean indexing has over the other 2 methods of
indexing is that it can guarantee that it references a position at most
once. Slicing and scalar indexes are also this way, hence why these methods
allow for in-place assignments. I don't see boolean indexing as an
extension of orthogonal indexing because of that.
Ben Root
On Thu, Apr 2, 2015 at 2:41 PM, Stephan Hoyer <shoyer at gmail.com> wrote:
> On Thu, Apr 2, 2015 at 11:03 AM, Eric Firing <efiring at hawaii.edu> wrote:
>
>> Fancy indexing is a horrible design mistake--a case of cleverness run
>> amok. As you can read in the Numpy documentation, it is hard to
>> explain, hard to understand, hard to remember.
>
>
> Well put!
>
> I also failed to correct predict your example.
>
>
>> So I think you should turn the question around and ask, "What is the
>> actual real-world use case for fancy indexing?" How often does real
>> code rely on it?
>
>
> I'll just note that Indexing with a boolean array with the same shape as
> the array (e.g., x[x < 0] when x has greater than 1 dimension) technically
> falls outside a strict interpretation of orthogonal indexing. But there's
> not any ambiguity in adding that as an extension to orthogonal indexing
> (which otherwise does not allow ndim > 1), so I think your point still
> stands.
>
> Stephan
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150402/1c208eaf/attachment.html>
More information about the NumPy-Discussion
mailing list