Why Python does *SLICING* the way it does??

Javier Bezos no.spam at see.below.es
Wed Apr 20 14:18:16 EDT 2005


<seberino at spawar.navy.mil> escribió en el mensaje
news:1113976729.450677.261130 at o13g2000cwo.googlegroups.com...
> Many people I know ask why Python does slicing the way it does.....
>
> Can anyone /please/ give me a good defense/justification???
>
> I'm referring to why mystring[:4] gives me
> elements 0, 1, 2 and 3 but *NOT* mystring[4] (5th element).
>
> Many people don't like idea that 5th element is not invited.
>
> (BTW, yes I'm aware of the explanation where slicing
> is shown to involve slices _between_ elements.  This
> doesn't explain why this is *best* way to do it.)

Recently there was a short (sub)thread about that.
One of my messages (against half-open slices) is,
for example

http://groups-beta.google.com/group/comp.lang.python/msg/5532dd50b57853b1

Javier

___________________________________________________________
Javier Bezos                | TeX y tipografía
jbezos at wanadoo dot es    | http://perso.wanadoo.es/jbezos
............................|...............................
CervanTeX (Spanish TUG)     | http://www.cervantex.org










More information about the Python-list mailing list