<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Jun 26, 2018 at 10:21 PM Juan Nunez-Iglesias <<a href="mailto:jni.soma@gmail.com">jni.soma@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>





<div><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Let me start by thanking Robert for articulating my viewpoints far better than I could have done myself. I want to explicitly flag the following statements for endorsement:<br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div>
<blockquote type="cite"><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span class="m_4048539841953192402highlight" style="background-color:rgb(255,255,255)"><span class="m_4048539841953192402colour" style="color:rgb(31,31,31)"><span class="m_4048539841953192402font" style="font-family:"Source Sans Pro",sans-serif"><span class="m_4048539841953192402size" style="font-size:14px"><i>I would still reserve warnings and deprecation for the cases where the current behavior gives us something that no one wants. Those are the real traps that people need to be warned away from.</i></span></span></span></span><br></div>
</blockquote><div><br></div>
<blockquote type="cite"><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span class="m_4048539841953192402highlight" style="background-color:rgb(255,255,255)"><span class="m_4048539841953192402colour" style="color:rgb(31,31,31)"><span class="m_4048539841953192402font" style="font-family:"Source Sans Pro",sans-serif"><span class="m_4048539841953192402size" style="font-size:14px"><i>In the post-NEP .oindex/.vindex order, everyone can get the behavior that they want. Your argument for deprecation is now just about what the default is, the semantics that get pride of place with the shortest spelling. I am sympathetic to the feeling like you wish you had a time machine to go fix a design with your new insight. But it seems to me that just changing which semantics are the default has relatively attenuated value while breaking compatibility for a fundamental feature of numpy has significant costs. Just introducing .oindex is the bulk of the value of this NEP. Everything else is window dressing.</i></span></span></span></span><br></div>
</blockquote><div><br></div>
<blockquote type="cite"><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span class="m_4048539841953192402highlight" style="background-color:rgb(255,255,255)"><span class="m_4048539841953192402colour" style="color:rgb(31,31,31)"><span class="m_4048539841953192402font" style="font-family:"Source Sans Pro",sans-serif"><span class="m_4048539841953192402size" style="font-size:14px"><i>If someone is mixing slices and integer indices, that's a really good sign that they thought indexing behaved in a different way (e.g. orthogonal indexing).</i></span></span></span></span><br></div>
</blockquote><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span class="m_4048539841953192402highlight" style="background-color:rgb(255,255,255)"><span class="m_4048539841953192402colour" style="color:rgb(31,31,31)"><span class="m_4048539841953192402font" style="font-family:"Source Sans Pro",sans-serif"><span class="m_4048539841953192402size" style="font-size:14px">I would offer the exception of trailing slices to this statement, though:</span></span></span></span><br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div>
<div>In [1]: from skimage import data<br></div>
<div>In [2]: astro = data.astronaut()<br></div>
<div>In [3]: astro.shape<br></div>
<div>Out[3]: (512, 512, 3)<br></div>
<div><br></div>
<div>In [4]: rr, cc = np.array([1, 3, 3, 3]), np.array([1, 8, 9, 10])<br></div>
<div>In [5]: astro[rr, cc].shape<br></div>
<div>Out[5]: (4, 3)<br></div>
<div><br></div>
<div>In [6]: astro[rr, cc, :].shape<br></div>
<div>Out[6]: (4, 3)<br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">This does exactly what I would expect.</div></div></blockquote><div><br></div><div>Yup, sorry, I didn't mean those. I meant when there is an explicit slice in between index arrays. (And maybe when index arrays follow slices; I'll need to think more on that.)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none">Going back to the motivation for the NEP, I think this bit, emphasis mine, is crucial:<br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div>
<blockquote type="cite"><blockquote type="cite"><div>the existing rules for advanced indexing with multiple array indices are typically confusing to both new, **and in many cases even old,** users of NumPy<br></div>
</blockquote></blockquote><div><br></div>
<div>I think it is ok for advanced indexing to be accessible to advanced users. I remember that it took me quite a while to grok NumPy advanced indexing, but once I did I just loved it.<br></div>
<div><br></div>
<div>I also like that this syntax translates perfectly from integer indices to float coordinates in `ndimage.map_coordinates`. <br></div>
<div><br></div>
<blockquote type="cite"><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span class="m_4048539841953192402highlight" style="background-color:rgb(255,255,255)"><span class="m_4048539841953192402colour" style="color:rgb(31,31,31)"><span class="m_4048539841953192402font" style="font-family:"Source Sans Pro",sans-serif"><span class="m_4048539841953192402size" style="font-size:14px"><i>I'll go on record as saying that array-likes should respond to `a[rr, cc]`, as in Juan's example, with the current behavior. And if they don't, they don't deserve to be operated on by skimage functions.</i></span></span></span></span><i><br></i></div>
</blockquote><div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><br></div>
<div style="color:rgb(31,31,31);font-family:"Source Sans Pro",sans-serif;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span class="m_4048539841953192402highlight" style="background-color:rgb(255,255,255)"><span class="m_4048539841953192402colour" style="color:rgb(31,31,31)"><span class="m_4048539841953192402font" style="font-family:"Source Sans Pro",sans-serif"><span class="m_4048539841953192402size" style="font-size:14px">(I don't think of us highly enough to use the word "deserve", but I would say that we would hesitate to support arrays that don't use this convention.)</span></span></span></span></div></div></blockquote><div><br></div><div>Ahem, yes, I was being provocative in a moment of weakness. May the array-like authors forgive me.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Robert Kern</div></div>