|
From: Sasha <nd...@ma...> - 2006-02-11 02:36:36
|
On 2/10/06, Gary Ruben <gr...@bi...> 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 =3D (stop - start)/step, empty range can be recognized by start=3Dstop test regardless of step, adjacent ranges - start2=3Dstop1 (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= :-)? |