[Numpy-discussion] number ranges (was Re: Matlab page on scipy wiki)

Gary Ruben gruben at bigpond.net.au
Mon Feb 13 20:33:12 CST 2006


I agree with Bill's comments. The other languages I've used have used 
closed/inclusive ranges, which made a lot of sense because they 
supported enumerated types. The Python Zen guideline breaks down for me 
because it never felt 'obvious' to me and the principle of least 
surprise told me to expect closed ranges. I can see the arguments for 
both though. I discovered that Ruby has both 0..10 and 0...10 syntax 
depending on whether you want open or closed ranges. I don't know if 
numpy should break with Python convention here and try to supply a 
closed range specifier because there should probably be a backup Zen 
guideline saying 'There should be one -- and preferably only one -- way 
to do it, even if it's not obvious.' If there was one, I'd use it in 
preference though.

Gary R.




More information about the Numpy-discussion mailing list