[Numpy-discussion] Matlab page on scipy wiki

Sasha ndarray at mac.com
Fri Feb 10 18:37:04 EST 2006


On 2/10/06, Gary Ruben <gruben at bigpond.net.au> wrote:
>...  I must say that Travis's
> example numpy.r_[1,0,1:5,0,1] highlights my pet hate with python - that
> the upper limit on an integer range is non-inclusive.

In this case you must hate that an integer range starts at 0 (I don't
think you would want len(range(10)) to be 11).   If this is the case,
I don't blame you: it is silly to start counting at 0, but
algorithmically it is quite natural.  Semi-closed integer ranges have
many algorithmic advantages as well such as length = (stop -
start)/step,  empty range can be recognized by start=stop test
regardless of step, adjacent ranges - start2=stop1 (again no need to
know step) etc.

> I'm sure the BDFL has some excuse for this silliness.

Maybe he does not like Fortran :-)

PS: What's your second favorite language (I assume that python is the first :-)?




More information about the NumPy-Discussion mailing list