Slice inconsistency?

Stephen Horne $$$$$$$$$$$$$$$$$ at $$$$$$$$$$$$$$$$$$$$
Sat Sep 27 21:46:53 CEST 2003

On Sat, 27 Sep 2003 12:56:25 -0400, "Terry Reedy" <tjreedy at>

>Sorry, wrong.  Tuple notation for single slices givea a different

A different implementation, but this is a high level language. The
caller is supposed to worry about the purpose of the syntax, not (as
far as possible) the implementation.

The idea that single slices *should* behave in a different way to
extended slices seem bizarre to me - the kind of thing that arises out
of historic issues rather than out of principle. And if they really
*should* have different meanings, why does this inconsistency
disappear at the first opportunity to remove it without back
compatibility issues (ie in new style classes), for which __getitem__
is called with a slice object (and no -ve index translation) for both
single and extended slices.

This isn't a criticism of Python - it is simply an example of how new
style classes has allowed vestiges from a less flexible past to be
tidied up. Python has grown without becoming a house of cards - that
is a good thing.

Steve Horne

steve at ninereeds dot fsnet dot co dot uk

More information about the Python-list mailing list