"Andreas Haller" <andreashaller / gmail.com> wrote in message news:0C1522C0-3313-4FE0-9846-077D70938EBF / gmail.com... >> My question is: how useful are all these different mechanisms? Do you >> find that having two operators .. and ... is a blessing, or a curse >> because you can never remember which is which? > > Hi > i think it makes perfect sense to have those two options and with such a > similar syntax. I had to think a second everytime to remember which is > which, but i got used to it now. (Although it does not make much sense to > me that three dots mean "less" than two dots.) I think of it as the shorter keyword being the one more often used. As I'm sure you know, half open intervals are used far more often than closed intervals... It's a little scary that they're so similar but do different things in that it may be easy to mistake one for the other. It would be an annoying typo bug to track down... >> [...]. range() always results in a half-open interval: >> range(1, 5) => 1, 2, 3, 4 > I had to look up the terms "half-open" and "half-closed". http:// > en.wikipedia.org/wiki/Interval_(mathematics) says that an half-open > interval (2,4] excludes 2, but includes 4. So in Python that would be > half-closed intervals by default (right?), ikewise in Ruby. I don't think that it would be half open, by default, in Python. More like it will always be half open in Python. > What i find strage about ranges is that: > (0..3).to_a # => [0, 1, 2, 3] > but > (3..0).to_a # => [] I find this strange, as well... Aside from breaking many lines of code, how bad would it be to change it?