[Python-ideas] [Python-Dev] Inclusive Range (original) (raw)

Boris Borcic bborcic at gmail.com
Tue Oct 5 13:45:56 CEST 2010


Nick Coghlan wrote:

[...] Being able to say things like "10:00"<= x< '12:00", 10.0<= x< 12.0, "a"<= x< "n" are much clearer than trying to specify their closed range equivalents.

makes one wonder about syntax like :

for 10 <= x < 20 : blah(x)

Mh, I suppose with rich comparisons special methods, it's possible to turn chained comparisons into range factories without introducing new syntax. Something more like

for x in (10 <= step(1) < 20) : blah(x)



More information about the Python-ideas mailing list