On 2007-10-01, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Sun, 30 Sep 2007 16:16:30 -0300, <[EMAIL PROTECTED]> escribi?: > >>> From my POV, if I want sequence from here to there, it should include >> both here and there. >> >> I do understand the consequences of making high bound exclusive, which >> is more elegant code: xrange(len(c)). But it does seem a bit >> illogical... > > See this note from E.W.Dijkstra in 1982 where he says that the Python > convention is the best choice. > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
It may be convincing if you only consider natural numbers in ascending order. Suppose you have the sequence a .. b and you want the reverse. If you work with included bounds the reverse is just b .. a. If you use the python convention, things become more complicated. Another problem is if you are working with floats. Suppose you have a set of floats. Now you want the subset of numbers that are between a and b included. If you want to follow the convention that means you have to find the smallest float that is bigger than b, not a trivial task. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list