Slice confusion : a[n:p] is a list exclude the last element p (thus spoke Dijkstra)

Andrew Koenig ark at research.att.com
Mon Apr 28 16:41:41 EDT 2003


June> A bit related to this is,
June> "Why Numbering Should Start At Zero" by Edsger Dijkstra at
June> http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF

Thanks for the reference.  I hadn't seen this (3-page) paper before; I
think it's elegant.

Incidentally, Dijkstra's argument about ``natural numbers'' translates
directly into an argument about pointers in C, which permits a pointer
to any element of an array, or to a position immediately past the last
element of an array, but does not allow a pointer to a position before
the beginning of an array.

-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark




More information about the Python-list mailing list