kvesteri / intervals

Python tools for handling intervals (ranges of comparable objects).
BSD 3-Clause "New" or "Revised" License
107 stars 17 forks source link

Feature/7 interval initialization #8

Open adarshk7 opened 10 years ago

adarshk7 commented 10 years ago

Add support for interval initialization.

eg. IntInterval(2, 5) == IntInterval((2, 5)) and IntInterval[2, 5] == IntInterval([2, 5])

kvesteri commented 10 years ago

The Interval class constructor needs to be changed so that it supports also the following scenarios:

IntInterval(2, 5, inc_upper=True) == IntInterval('(2, 5]']
IntInterval(2, 5, inc_lower=True) == IntInterval('[2, 5)']
IntInterval(2, 5, inc_lower=True, inc_upper=True) == IntInterval[2, 5]