Greetings: > -----Original Message----- > Date: Sun, 04 Jun 2006 18:43:25 -0700 > From: Yi Qiang <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Not Really Questions > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset=ISO-8859-1 > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Alan Gauld wrote, On 06/04/2006 04:01 PM: > > Hi John, > > > > I'll pitch in although I've read most of the other answers > > too so I'll be adding to them mostly. > > > >> The first one is lists... I can't for the life of me understand why > >> a list > >> starts at zero. In everything else in life other than programming > > > > Not quite. In math zero is usually the starting point, its generally > > viewed as a positive number(although it is obviously neither positive > > or negative) and proofs and definitions usually start by consideriung > > zero - or at least defining whether zero is in or out of scope. > That is just not true. A number is positive if and only if it is > strictly greater than 0 by definition. Zero is not considered positive > in mathematics. In fact, the set of positive integers, Z+, is the set > {1,2,3,....}. > - -- > Yi Qiang ([EMAIL PROTECTED]) > Web: http://www.yiqiang.net > Tel: (206) 661-8469 > PGP: 0xB515564B
[Somewhat off topic] Strictly speaking, Yi Qiang is correct, of course. The set Z+ (which BTW is identical with the set of natural numbers, N), does not include 0. 0 is neither positive nor negative. However, the set of non-negative numbers does include 0, as does the set of non-positive numbers. The former set, {0, 1, 2, ...}, is the one associated with lists, arrays, etc, as it is possible to have 0 or more elements in a list, while it is not possible to have less than 0 elements. [Back on topic] Like John, I find the half-open range concept to be 'unnatural'. When waiting for checkout at the market, I don't think of myself as being 'zeroth' in line; I'm either 'first' or 'next' in line. For me, it's a matter of context. When programming, it helps remind myself that I'm not in the 'natural' universe where 'natural numbers' are the rule. I'm in the computer's mathematical universe, where 'zeroth' in line is perfectly natural. =8^) HTH Barry [EMAIL PROTECTED] 541-302-1107 ________________________ We who cut mere stones must always be envisioning cathedrals. -Quarry worker's creed _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor