python for loop

Diez B. Roggisch deets at nospam.web.de
Wed Apr 1 09:50:36 CEST 2009


Lada Kugis schrieb:
> On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano
> <steven at REMOVE.THIS.cybersource.com.au> wrote:
> 
>> Why Python (and other languages) count from zero instead of one, and 
>> why half-open intervals are better than closed intervals:
>>
>> http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/
>> http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
> 
> steven, thanks for answering,
> 
> yes, i saw the second one a little time ago (someone else posted it as
> well in really cute handwriting version :) and the first time just
> now, but the examples which both of them give don't seem to me to be
> that relevant, e.g. the pros don't overcome the cons.
> 
> imho, although both sides (mathematical vs engineer) adress some
> points, none of them give the final decisive argument.
> i understand the math. point of view, but from the practical side it
> is not good. it goes nicely into his tidy theory of everything, but
> practical and intuitive it is not.

You keep throwing around the concept of "intuition" as if it were 
something that existis in a globally fixed frame of reference. It is not.

 From [1]:

"""
Klein found that under time pressure, high stakes, and changing 
parameters, experts used their base of experience to identify similar 
situations and intuitively choose feasible solutions.
"""

In other words: your gained *knowledge* (including mathematical 
know-how) determines what's intuitive - to *you*.

So all arguing about intuition is rather irrelevant - to me, zero-based 
counting is intuitive, and it is so with the same right as you prefer 
one-based.

OTOH zero-based counting has technical reasons that also reduces the 
amount of leaky abstraction problems [2], as it models the underlying 
reality of memory locations + indexing.

Diez



[1] http://en.wikipedia.org/wiki/Intuition_(knowledge)
[2] http://www.joelonsoftware.com/articles/LeakyAbstractions.html



More information about the Python-list mailing list