Range Operation pre-PEP

Carlos Ribeiro cribeiro at mail.inet.com.br
Wed May 9 12:05:38 EDT 2001


At 09:52 09/05/01 -0600, Bjorn Pettersen wrote:
>If we really want range literals (which I don't see as particularly useful
>outside this application although I'm happy to be proven wrong <wink>) ...

I would really like to perform set operations in Python. Some good 
libraries already provide support for this (kjBuckets comes to mind). The 
a..b syntax is a nice way to specify arbitrary set constants, such as in:

if some_number in [1..3,7..9]:
    do_something()

There are several uses for constructs like the one above. I keep thinking 
that '..' is clearly inclusive, so why not give it a try?


Carlos Ribeiro






More information about the Python-list mailing list