Assignment to slice

Terry Reedy tjreedy at
Wed Jan 21 22:21:00 CET 2004

"Rich Krauter" <rmkrauter at> wrote in message
news:mailman.604.1074712550.12720.python-list at

Guido very intentionally made index access of items strict and slice access
of subsequences permissive.  This partly due to the difference between
items, which must exist, and subsequences, which can be empty.  It also
gives programmers a choice in some situations.  For instance, seq[0] only
works on non-empty seqs while seq[0:1] gives you a sequence with 0 or 1
items without raising an error to catch when there are 0.

> Oh well. Maybe my problem is that I'm using perl as my
> model of consistency.

How amusing ;-)

> I just need to be aware of it, and not try to write
> perl code in python. I need to learn to write python
> code in python.

Definitely.  Good insight.

Terry J. Reedy

More information about the Python-list mailing list