On Thursday, February 14, 2013 1:58:06 PM UTC-5, Ian wrote:
>
> That's not ambiguous, because the former is simply invalid syntax.
>
> However, consider the following.
>
>
>
> if 1: 2:
>
>
>
> That could be either a one-line if statement where the condition is 1
>
> and the body is slice(2
>
> You can't just allow ':' to generate slice objects everwhere without
>
> introducing ambiguity, so your proposal would have to be to allow slice
>
> objects in wider but still restricted contexts.
Yeah, I mentioned that in a follow-up. I'm pretty sure of just allowing it
within [] and ()
> Hah, yes. I basically wrote that exact example in my reply to Steven at the
> same time you replied. numpy.s_ is similar (although I think it does some
> extra work for odd reasons).
Oops, this is silly in retrospect...sorry, wasn't looking at the From: line
carefully enough and didn't realiz
On Thursday, February 14, 2013 3:03:50 AM UTC-5, Steven D'Aprano wrote:
> On Wed, 13 Feb 2013 21:54:43 -0800, stephenwlin wrote:
>
>
>
> >> I believe the idea of slice literals has been rejected.
>
> >>
>
> >>
>
> > That's t
>
>
> >> I believe the idea of slice literals has been rejected.
>
> >>
>
> >>
>
> > That's too bad...do you have a link to prior discussion on this and what
>
> > the reasoning was for rejection? There doesn't seem to be any particular
>
> > downside and things would be more consistent wi
Apparently Travis Oliphant of numpy would like this as well...
http://technicaldiscovery.blogspot.com/2011/06/python-proposal-enhancements-i-wish-i.html
On Wednesday, February 13, 2013 2:00:15 PM UTC-5, steph...@gmail.com wrote:
> Hello,
>
>
>
> Would it be feasible to modify the Python gramma
>
> I believe the idea of slice literals has been rejected.
>
That's too bad...do you have a link to prior discussion on this and what the
reasoning was for rejection? There doesn't seem to be any particular downside
and things would be more consistent with slice syntax allowed anywhere.
It w
Hello,
Would it be feasible to modify the Python grammar to allow ':' to generate
slice objects everywhere rather than just indexers and top-level tuples of
indexers?
Right now in Py2.7, Py3.3:
"obj[:,2]" yields "obj[slice(None),2]"
but
"obj[(:,1),2]" is an error, instead of "obj[(slice