Questions regarding design decisions in listobject.c

Courageous jkraska1 at san.rr.com
Sun Jun 4 16:19:10 EDT 2000


1. For slice operations, ilow/ihigh indices which undeflow
or overflow the list in question are reset to the edges
of the list. Why was it that PyExc_IndexError wasn't
thrown instead?

2. In slice expressions of the form s[i:j], what was the
design decision that lead to s[i:i] always returning an
empty list and s[i:i+1] selecting one item. At first
glance, it would appear that s[i:i] is the obvious and
intuitive correct expression to return just one item on
a slice, where s[i:i+1] ought to select two items and so
forth. Was there some particular situation which arose
which required this slightly counterintuitive idiom?



C/



More information about the Python-list mailing list