Jay _______________________________________________ Edu-sig mailing list -- edu-sig@python.org To unsubscribe send an email to edu-sig-le...@python.org https://mail.python.org/mailman3/lists/edu-sig.python.org/
Does anybody have a nice, student friendly explanation of the
"half-open" semantics of the range function and of slice notation? In
other words, why does the list created by range(0,10) contain 0 as an
element but not 10, and why does mylist[0:10] start with mylist[0] and
end with mylist[9]? If you're an experienced coder, these semantics make
sense in terms of the underlying implementation and the usual use of
these objects as iterators, but if lists are new to you the behavior can
seem a little mysterious. Thoughts?
- [Edu-sig] range() and slice semantics Jay Bloodworth
- [Edu-sig] Re: range() and slice semantics Tim Peters