<div dir="ltr"><div>TBH, I wouldn't have expected it to work, but now that I see it, it does make some sense. I would have thought that it would error out as being ambiguous (prepend? append?). I have always used ellipses to make it explicit where the new axis should go. But, thinking in terms of how regular indexing works, I guess it isn't all that ambiguous.<br><br></div>Ben Root<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 31, 2015 at 11:56 AM, Joe Kington <span dir="ltr"><<a href="mailto:joferkington@gmail.com" target="_blank">joferkington@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Slicing with None adds a new dimension.  It's a common paradigm, though usually you'd use A[np.newaxis] or A[np.newaxis, ...] instead for readibility.   (np.newaxis is None, but it's a lot more readable)<br><br></div>There's a good argument to be made that slicing with a single None shouldn't add a new axis, and only the more readable forms like A[None, :], A[..., None], etc should.   <br><br>However, that would rather seriously break backwards compatibility. There's a fair amount of existing code that assumes "A[None]" prepends a new axis.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 31, 2015 at 10:36 AM, Neal Becker <span dir="ltr"><<a href="mailto:ndbecker2@gmail.com" target="_blank">ndbecker2@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Neal Becker wrote:<br>
<br>
> In my case, what it does is:<br>
><br>
> A.shape = (5760,)<br>
> A[none] -> (1, 5760)<br>
><br>
> In my case, use of none here is just a mistake.  But why would you want<br>
> this to be accepted at all, and how should it be interpreted?<br>
<br>
</span>Actually, in my particular case, if it just acted as a noop, returning the<br>
original array, that would have been perfect.  No idea if that's a good<br>
result in general.<br>
<div><div><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>