Johan Dahlin schrieb: > Guido van Rossum wrote: >> Do we really need another way to spell a <= x < b? > > FWIW, I'd say yes; I sometimes find it a bit difficult to remember > how the operator should be placed, there are several possible ways > of making a mistake, eg; > > a > x < b > a < x > b > a < x < b > a > x > b > > Now, the range syntax seems a bit strange at first, but I find it easier > to parse: > > if x in range(a, b) > > There's no way to incorrectly parse that, it's immediately known that > the programmer tries to see whether x is in a specific range.
What about floats? Currently, "3.5 in range(5)" is False, while "0 <= 3.5 < 5" is True. Georg -- Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out. _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
