[Python-Dev] Adding an rslice() builtin?

Paul Moore p.f.moore at gmail.com
Tue Aug 29 14:46:33 CEST 2006


On 8/29/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Nick Coghlan wrote:
>
> >    reversed(seq[start:stop:step]) becomes seq[(stop-1)%abs(step):start-1:-step]
> >
> > An rslice builtin would make the latter version significantly easier to read:
> >
> >    seq[rslice(start, stop, step)]
>
> How would this deal with omitted start and/or stop values?

More generally, given start/stop/step don't have to be numbers, how
can this work in general?

I don't actually see a need for this, given that
reversed(seq[start:stop:step]) covers all of the real use cases I can
think of...

Paul.


More information about the Python-Dev mailing list