negative indices for sequence types
Michael Peuser
mpeuser at web.de
Mon Sep 8 02:01:16 EDT 2003
"dan" <danbmil99 at yahoo.com>
> I was recently surprised, and quite shocked in fact, to find that
> Python treats negative indices into sequence types as if they were
> mod(length-of-sequence), at least up to -len(seq).
>
> This fact is *deeply* buried in the docs, and is not at all intuitive.
I think it is addressed even in most tutorials because it is quite handy as
others already pointed out. There is the same fetaure in Perl.
Kindly
Michael P
More information about the Python-list
mailing list