Possible improvement to slice opperations.
pmaupin at gmail.com
Tue Sep 6 03:42:27 CEST 2005
> No one has yet explained the reasoning (vs the mechanics) of the
> returned value of the following.
> L = range(10)
> So far every attempt to explain it has either quoted the documents which
> don't address that particular case, or assumed I'm misunderstanding
> something, or implied it isn't neccisary to do.
> It's quite easy to get me to change my mind on something, just show me a
> convincing explanation and I will. :)
Once I saw this, I was surprised, because slices currently work exactly
like I would and do expect on this example, so I now have to admit that
I didn't read your original post fully and carefully. I have gone back
to look to figure out what you don't like and what you want, and I am
To me, your way reeks of black magic -- if there is a sign on the
stride, then strange and wondrous transformations happen. I think it
is conceptually (and probably programatically) much simpler the way it
In any case, you asked for a rationale. I'll give you mine:
>>> L = range(10)
>>> L[3:len(L):-1] == [L[i] for i in range(3,len(L),-1)]
If you manage somehow to hange that 'True' to a 'False', I'll
personally be extremely unhappy.
More information about the Python-list