[SciPy-dev] Possible inconsistency in arrays.indexing.rst

David Goldsmith d.l.goldsmith at gmail.com
Sun Dec 13 22:30:16 EST 2009


Hi, folks.  arrays.indexing.rst has the following two passages, along
with a Note asserting that they are inconsistent:

Passage 1) in the section titled "Basic Slicing": "Basic slicing
occurs when [the selection] obj is a slice object (constructed by
start:stop:step notation inside of brackets), an integer, or a tuple
of slice objects and integers ... In order to remain backward
compatible with a common usage in Numeric, basic slicing is also
initiated if the selection object is any sequence (such as a list)
containing slice objects..."

Passage 2) in the "Warning" just preceding the section titled "Record
Access": "... x[[1,2,3]] will trigger advanced indexing, whereas
x[[1,2,slice(None)]] will trigger basic slicing."

Note (originally following the "Warning," but now moved to the
Discussion): "the above warning needs explanation as the last part is
at odds with the definition of basic indexing."

But is it?  The "definition" of "basic slicing" (I find no
"definition," as such, of "basic indexing") includes the statement
that "basic slicing is initiated if the selection object is any
sequence ... containing slice objects," but the way the prior sentence
(the main part of the "definition") is written, it is not crystal
clear whether _any_ sequence of individual integers constitutes a
"slice object" or not - I can see it being interpreted either way.
And either way - if it is an inconsistency, then it needs to be
corrected, and if it isn't, then the fact that someone thought it was
clearly points to the issue needing clarification - some reworking is
necessary.  So, I put it to you, the experts: is this an inconsistency
or not?

Also w.r.t. the Note: it states "this section may need some tuning": I
assume that if "this" were meant to refer to the (immediately
following) section, the writer (who is not readily identified, as the
author in the log is "Source") would have said "The following
section," and I thus conclude that "this" refers to the section the
Note ends, but I would appreciate confirmation from the author (I hope
s/he reads this), along with, more importantly, clarification of
precisely what it is about the section that the Note writer feels
needs "tuning."

Thanks!

DG



More information about the SciPy-Dev mailing list