Slicing in Python 2.3a2

Michael Hudson mwh at python.net
Wed Apr 2 10:48:05 EST 2003


Dave Benjamin <ramen at lackingtalent.com> writes:

> I think it makes sense if you think in terms of "start", "stop", and "step".
> The step amount represents the value that is added to the implicit counter
> with each iteration. I think that the confusion actually comes from the
> defaults for start and stop if they are not supplied. It seems from your
> example (and the [::-1] form) that the defaults for start and stop are
> swapped if the step is negative.

Yep!  You wouldn't believe the amount of hair I tore out implementing
all that...

Cheers,
M.

-- 
  I'm not sure that the ability to create routing diagrams 
  similar to pretzels with mad cow disease is actually a 
  marketable skill.                                     -- Steve Levin
               -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html




More information about the Python-list mailing list