On Wed, 30 Jan 2013 03:59:32 +0000, MRAB wrote:

> Python uses half-open ranges (and counts from 0), which means that the
> start index is included and the end index is excluded.
> 
> Therefore, worst_offenders[5:6] means the slice from index 5 up to, but
> excluding, index 6; in other words, an empty list.

Er, no. It's a one-element list: index 5 is included, index 6 is excluded.

py> L = list("abcdefgh")
py> L[5:6]
['f']




-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to