Re: Python "why" questions

2010-08-23 Thread Russ P.
On Aug 23, 7:46 pm, alex23 wrote: > "Russ P." wrote: > > However, I've switched from Python to > > Scala, so I really don't care. > > Really? Your endless whining in this thread would seem to indicate > otherwise. Yes, I guess I care some, but not much. I still use Python for some things, and I

Re: Python "why" questions

2010-08-23 Thread alex23
"Russ P." wrote: > However, I've switched from Python to > Scala, so I really don't care. Really? Your endless whining in this thread would seem to indicate otherwise. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-22 Thread Russ P.
On Aug 22, 12:47 am, Chris Rebert wrote: > On Sun, Aug 22, 2010 at 12:23 AM, Russ P. wrote: > > On Aug 21, 1:33 am, Steven D'Aprano > cybersource.com.au> wrote: > >> On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: > >> > Most programmers probably never use vectors and matrices, so they don't

Re: Python "why" questions

2010-08-22 Thread Neil Cerutti
On 2010-08-21, Steven D'Aprano wrote: > There is room in the world for programming languages aimed at > non- programmers (although HC is an extreme case), but not all > languages should prefer the intuition of non-programmers over > other values. Extremer: Inform 7. -- Neil Cerutti -- http://m

Re: Python "why" questions

2010-08-22 Thread Chris Rebert
On Sun, Aug 22, 2010 at 12:23 AM, Russ P. wrote: > On Aug 21, 1:33 am, Steven D'Aprano cybersource.com.au> wrote: >> On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: >> > Most programmers probably never use vectors and matrices, so they don't >> > care about the inconsistency with standard math

Re: Python "why" questions

2010-08-22 Thread Russ P.
On Aug 21, 1:33 am, Steven D'Aprano wrote: > On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: > > Most programmers probably never use vectors and matrices, so they don't > > care about the inconsistency with standard mathematical notation. > > Perhaps you should ask the numpy programmers what th

Re: Python "why" questions

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 09:21:25 +0200, Kai Borgolte wrote: > Sorry about my previous posting with wrong references, this one should > be better. > > Steven D'Aprano wrote: > >>A simple example: Using zero-based indexing, suppose you want to indent >>the string "spam" so it starts at column 4. How m

Re: Python "why" questions

2010-08-21 Thread Steven D'Aprano
On Fri, 20 Aug 2010 11:01:42 -0700, Russ P. wrote: > Most programmers probably never use vectors and matrices, so they don't > care about the inconsistency with standard mathematical notation. Perhaps you should ask the numpy programmers what they think about that. Vectors and matrices are just

Re: Python "why" questions

2010-08-20 Thread Gregory Ewing
Russ P. wrote: It all boils down to personal preference, but I just find it strange that we would not try to make programming as consistent as possible with notational conventions in the literature. It doesn't matter how much mathematical convention you quote, your assertion that 1-based indexi

Re: Python "why" questions

2010-08-20 Thread Gregory Ewing
Martin Braun wrote: Another thing worth mentioning (I guess here is a good a place as any other) is the fact that programming and mathematics are still pretty different things, despite how much we programmers would like to think ourselves as some kind of mathematician. Although when it comes

Re: Python "why" questions

2010-08-20 Thread Gregory Ewing
J.B. Brown wrote: Then users of my class (mainly my research lab coworkers) could specify whichever behavior they wanted. In terms of providing readable code and removing beginning programmer confusion, But having some arrays indexed from 0 and others from 1 can be a recipe for confusion in i

Re: Python "why" questions

2010-08-20 Thread Gregory Ewing
Robert Kern wrote: On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: In message, Roy Smith wrote: 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? c) neither of the above. More specifically, 13,001 (if I counted correctly). 13000, a

Re: Python "why" questions

2010-08-20 Thread Gregory Ewing
Martin Gregorie wrote: On Mon, 16 Aug 2010 12:33:51 +1200, Gregory Ewing wrote: Ian Kelly wrote: On Fri, Aug 13, 2010 at 11:53 AM, Martin Gregorie wrote: real sample[-500:750]; Ugh, no. The ability to change the minimum index is evil. Not always; it can have its uses, particul

Re: Python "why" questions

2010-08-20 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: That is not some kind of ordinal numbering of the terms, that is the power of the variable involved. It's both. Convention is to make the power and the index of the coefficent the same, because it would be pointlessly confusing to do anything else. -- Greg -- http:/

Re: Python "why" questions

2010-08-20 Thread geremy condra
On Fri, Aug 20, 2010 at 12:31 PM, Russ P. wrote: > On Aug 20, 11:19 am, geremy condra wrote: > >> Not sure what you read, but for me (mostly number theory, numerical >> analysis, and abstract algebra) zero-based indexing is quite common. > > My background is in aerospace control engineering. I am

Re: Python "why" questions

2010-08-20 Thread Russ P.
On Aug 20, 11:19 am, geremy condra wrote: > Not sure what you read, but for me (mostly number theory, numerical > analysis, and abstract algebra) zero-based indexing is quite common. My background is in aerospace control engineering. I am certainly not familiar with the literature in pure mathem

Re: Python "why" questions

2010-08-20 Thread geremy condra
On Fri, Aug 20, 2010 at 11:01 AM, Russ P. wrote: > On Aug 20, 1:23 am, Martin Braun wrote: > >> I find this thread extremely interesting, but what surprised me that >> everyone seems to agree that mathematics is 1-based, but we Pythoneers >> should stick to zero-based. I disagree. To make sure I'

Re: Python "why" questions

2010-08-20 Thread Russ P.
On Aug 20, 1:23 am, Martin Braun wrote: > I find this thread extremely interesting, but what surprised me that > everyone seems to agree that mathematics is 1-based, but we Pythoneers > should stick to zero-based. I disagree. To make sure I'm not going > crazy, I took the top five books lying on

Re: Python "why" questions

2010-08-20 Thread Martin Braun
On Thu, Aug 19, 2010 at 07:13:50PM +, Steven D'Aprano wrote: > Mathematics is an ancient art that values tradition and convention. It > doesn't matter how hard it was to come up with a proof, or how difficult > to verify it. Mathematicians value logical correctness and some > undefinable sen

Re: Python "why" questions

2010-08-20 Thread Kai Borgolte
Sorry about my previous posting with wrong references, this one should be better. Steven D'Aprano wrote: >A simple example: Using zero-based indexing, suppose you want to indent >the string "spam" so it starts at column 4. How many spaces to you >prepend? No, you won't want to indent a string

Re: Python "why" questions

2010-08-20 Thread Kai Borgolte
Russ P. wrote: >> A simple example: Using zero-based indexing, suppose you want to indent >> the string "spam" so it starts at column 4. How many spaces to you >> prepend? No, you won't want to indent a string so it starts at column 4. You simply want to indent the string by four spaces. Like in

Re: Python "why" questions

2010-08-19 Thread geremy condra
On Thu, Aug 19, 2010 at 12:32 PM, Steven D'Aprano wrote: > On Thu, 19 Aug 2010 11:57:53 -0700, Russ P. wrote: > >> I don't >> know where zero-based indexing started, but I know that C used it very >> early, probably for some minuscule performance advantage. > > In C, zero based indexing was used b

Re: Python "why" questions

2010-08-19 Thread MRAB
Russ P. wrote: Yes, apparently Basic uses one-based indexing too. For arrays, yes and no. Traditionally, DIM A(10) has 11 elements, starting at 0, although it might depend on the version of Basic. For strings, yes. As for Ada, apparently, the programmer needs to explicitly define the index r

Re: Python "why" questions

2010-08-19 Thread MRAB
Russ P. wrote: On Aug 19, 11:42 am, Steven D'Aprano wrote: On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote: For those who insist that zero-based indexing is a good idea, why you suppose mathematical vector/matrix notation has never used that convention? I have studied and used linear algebra

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:57:53 -0700, Russ P. wrote: > I don't > know where zero-based indexing started, but I know that C used it very > early, probably for some minuscule performance advantage. In C, zero based indexing was used because it made pointer arithmetic elegant and reduced bugs. > Wh

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 12:13 pm, Steven D'Aprano While businesses are conservative in which languages they choose, > language designers are not conservative in the design features they come > up with. That there has been a gradual (although as yet incomplete) > convergence towards zero-based indexing in langu

Re: Python "why" questions

2010-08-19 Thread AK
On 08/19/2010 02:04 PM, Steven D'Aprano wrote: On Tue, 17 Aug 2010 19:15:54 -0700, Russ P. wrote: The convention of starting with zero may have had some slight performance advantage in the early days of computing, but the huge potential for error that it introduced made it a poor choice in the

Re: Python "why" questions

2010-08-19 Thread Russ P.
Yes, apparently Basic uses one-based indexing too. As for Ada, apparently, the programmer needs to explicitly define the index range for every array. Weird. But I get the impression that one- based indexing is used much more than zero-based indexing. -- http://mail.python.org/mailman/listinfo/pyt

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:27:18 -0700, Russ P. wrote: [...] >> Zero-based counting doesn't entirely eliminate off-by-one errors, but >> the combination of that plus half-open on the right intervals reduces >> them as much as possible. >> >> The intuitive one-based closed interval notation used in man

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 11:42 am, Steven D'Aprano wrote: > On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote: > > For those who insist that zero-based indexing is a good idea, why you > > suppose mathematical vector/matrix notation has never used that > > convention? I have studied and used linear algebra exte

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:39:05 -0700, Russ P. wrote: > I just checked, and Mathematica uses one-based indexing. Apparently they > want their notation to look mathematical. Well duh. It's called MATHematica, not PROGematica. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Thu, 19 Aug 2010 11:03:53 -0700, Russ P. wrote: > For those who insist that zero-based indexing is a good idea, why you > suppose mathematical vector/matrix notation has never used that > convention? I have studied and used linear algebra extensively, and I > have yet to see a single case of ve

Re: Python "why" questions

2010-08-19 Thread Russ P.
I just checked, and Mathematica uses one-based indexing. Apparently they want their notation to look mathematical. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 11:04 am, Steven D'Aprano wrote: > On Tue, 17 Aug 2010 19:15:54 -0700, Russ P. wrote: > > The convention of starting with zero may have had some slight > > performance advantage in the early days of computing, but the huge > > potential for error that it introduced made it a poor choice

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Tue, 17 Aug 2010 19:15:54 -0700, Russ P. wrote: > The convention of starting with zero may have had some slight > performance advantage in the early days of computing, but the huge > potential for error that it introduced made it a poor choice in the long > run, at least for high-level language

Re: Python "why" questions

2010-08-19 Thread Russ P.
On Aug 19, 9:07 am, "J.B. Brown" wrote: > 2010/8/9 MRAB : > > > Default User wrote: > > >> Not to prolong a good "food fight", but IIRC, many years ago in QBasic, > >> one could choose > > >> OPTION BASE 0 > > >> or > > >> OPTION BASE 1 > > When I wrote my own C++ 2-D matrix class, I wrote a membe

Re: Python "why" questions

2010-08-19 Thread Neil Cerutti
On 2010-08-19, J.B. Brown wrote: > When I wrote my own C++ 2-D matrix class, I wrote a member > function which did exactly this - allow you to specify the > initial index value. Then users of my class (mainly my research > lab coworkers) could specify whichever behavior they wanted. I did somethi

Re: Python "why" questions

2010-08-19 Thread J.B. Brown
2010/8/9 MRAB : > Default User wrote: >> >> Not to prolong a good "food fight", but IIRC, many years ago in QBasic, >> one could choose >> >> OPTION BASE 0 >> >> or >> >> OPTION BASE 1 >> When I wrote my own C++ 2-D matrix class, I wrote a member function which did exactly this - allow you to spec

Re: Python "why" questions

2010-08-19 Thread Grant Edwards
On 2010-08-19, Russ P. wrote: > And I'd still like to know if the "1st" element of aList is aList[0] > or aList[1]. aList[0] -- Grant Edwards grant.b.edwardsYow! I'm definitely not at in Omaha!

Re: Python "why" questions

2010-08-19 Thread Steven D'Aprano
On Wed, 18 Aug 2010 21:55:30 -0700, Russ P. wrote: > On Aug 18, 7:58 pm, Steven D'Aprano t...@cybersource.com.au> wrote: >> On Wed, 18 Aug 2010 14:47:08 -0700, Russ P. wrote: >> > Is the top team in the league the number 1 team -- or the number 0 >> > team? I have yet to hear anyone call the best

Re: Python "why" questions

2010-08-18 Thread Russ P.
On Aug 18, 7:58 pm, Steven D'Aprano wrote: > On Wed, 18 Aug 2010 14:47:08 -0700, Russ P. wrote: > > Is the top team in the league the number 1 team -- or the number 0 team? > > I have yet to hear anyone call the best team the number 0 team! > > Why is the top team the one with the lowest number?

Re: Python "why" questions

2010-08-18 Thread Steven D'Aprano
On Wed, 18 Aug 2010 14:47:08 -0700, Russ P. wrote: > Is the top team in the league the number 1 team -- or the number 0 team? > I have yet to hear anyone call the best team the number 0 team! Why is the top team the one with the lowest number? > Unfortunately, we're stuck with this goofy number

Re: Python "why" questions

2010-08-18 Thread Dan Sommers
On Wed, 18 Aug 2010 16:56:22 -0400, AK wrote: > Contrast this with _one_ example that was repeated in this thread of > there being ground floor, 1st floor, 2nd, and so on. However! Consider > that ground floor is kind of different from the other floors. It's the > floor that's not built up over gr

Re: Python "why" questions

2010-08-18 Thread Mark Lawrence
On 18/08/2010 22:47, Russ P. wrote: On Aug 18, 2:01 pm, AK wrote: On 08/17/2010 10:15 PM, Russ P. wrote: On Aug 7, 5:54 am, "D'Arcy J.M. Cain"wrote: Would said beginner also be surprised that a newborn baby is zero years old or would it be more natural to call them a one year old? Z

Re: Python "why" questions

2010-08-18 Thread Russ P.
On Aug 18, 2:01 pm, AK wrote: > On 08/17/2010 10:15 PM, Russ P. wrote: > > > > > On Aug 7, 5:54 am, "D'Arcy J.M. Cain"  wrote: > > >> Would said beginner also be surprised that a newborn baby is zero years > >> old or would it be more natural to call them a one year old?  Zero > >> based counting

Re: Python "why" questions

2010-08-18 Thread AK
On 08/17/2010 10:15 PM, Russ P. wrote: On Aug 7, 5:54 am, "D'Arcy J.M. Cain" wrote: Would said beginner also be surprised that a newborn baby is zero years old or would it be more natural to call them a one year old? Zero based counting is perfectly natural. You're confusing continuous and

Re: Python "why" questions

2010-08-18 Thread AK
On 08/17/2010 10:15 PM, Russ P. wrote: On Aug 7, 5:54 am, "D'Arcy J.M. Cain" wrote: Would said beginner also be surprised that a newborn baby is zero years old or would it be more natural to call them a one year old? Zero based counting is perfectly natural. You're confusing continuous and

Re: Python "why" questions

2010-08-17 Thread Russ P.
On Aug 7, 5:54 am, "D'Arcy J.M. Cain" wrote: > Would said beginner also be surprised that a newborn baby is zero years > old or would it be more natural to call them a one year old?  Zero > based counting is perfectly natural. You're confusing continuous and discrete variables. Time is a continu

Re: Python "why" questions

2010-08-17 Thread geremy condra
On Tue, Aug 17, 2010 at 7:59 AM, Lie Ryan wrote: > On 08/16/10 21:54, David Cournapeau wrote: >> On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing >> wrote: On Aug 7, 2010, at 9:14 PM, John Nagle wrote: >  The languages which have real multidimensional arrays, rather > than arrays

Re: Python "why" questions

2010-08-17 Thread Roy Smith
In article <4c6a8cf...@dnews.tpgi.com.au>, Lie Ryan wrote: > On 08/16/10 21:54, David Cournapeau wrote: > > On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing > > wrote: > >>> On Aug 7, 2010, at 9:14 PM, John Nagle wrote: > >>> > The languages which have real multidimensional arrays, rather >

Re: Python "why" questions

2010-08-17 Thread Roy Smith
In article , Martin Gregorie wrote: > > Roy wasn't using numpy/Python semantics but made-up semantics (following > > Martin Gregorie's made-up semantics to which he was replying) which > > treat the step size as a true size, not a size and direction. The > > direction is determined from the star

Re: Python "why" questions

2010-08-17 Thread Martin Gregorie
On Tue, 17 Aug 2010 10:22:27 -0500, Robert Kern wrote: > On 8/16/10 11:10 PM, Steven D'Aprano wrote: >> On Mon, 16 Aug 2010 22:56:20 -0500, Robert Kern wrote: >> >>> On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: > In message, Roy Smith > wr

Re: Python "why" questions

2010-08-17 Thread Robert Kern
On 8/16/10 11:10 PM, Steven D'Aprano wrote: On Mon, 16 Aug 2010 22:56:20 -0500, Robert Kern wrote: On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: In message, Roy Smith wrote: 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? a) 299

Re: Python "why" questions

2010-08-17 Thread Lie Ryan
On 08/16/10 21:54, David Cournapeau wrote: > On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing > wrote: >>> On Aug 7, 2010, at 9:14 PM, John Nagle wrote: >>> The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That refl

Re: Python "why" questions

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 22:56:20 -0500, Robert Kern wrote: > On 8/16/10 9:29 PM, Roy Smith wrote: >> In article, >> Lawrence D'Oliveiro wrote: >> >>> In message, Roy Smith wrote: >>> 5) real intensity[160.0 : 30.0 : 0.01] >>> >>> How many elements in that array? >>> >>> a) 2999 >>> b) 3000 >>>

Re: Python "why" questions

2010-08-16 Thread Robert Kern
On 8/16/10 9:29 PM, Roy Smith wrote: In article, Lawrence D'Oliveiro wrote: In message, Roy Smith wrote: 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? a) 2999 b) 3000 c) neither of the above c) neither of the above. More specifically, 13,001 (if I counted co

Re: Python "why" questions

2010-08-16 Thread Roy Smith
In article , Lawrence D'Oliveiro wrote: > In message , Roy Smith wrote: > > > 5) real intensity[160.0 : 30.0 : 0.01] > > How many elements in that array? > > a) 2999 > b) 3000 > c) neither of the above c) neither of the above. More specifically, 13,001 (if I counted correctly). -- http://

Re: Python "why" questions

2010-08-16 Thread Lawrence D'Oliveiro
In message , Roy Smith wrote: > 5) real intensity[160.0 : 30.0 : 0.01] How many elements in that array? a) 2999 b) 3000 c) neither of the above -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-16 Thread Roy Smith
In article , Martin Gregorie wrote: > Say you have intensity data captured from an X-ray goniometer from 160 > degrees to 30 degrees at 0.01 degree resolution. Which is most evil of > the following? > > 1) real intensity[16000:3000] >for i from lwb intensity to upb intensity > plot(

Re: Python "why" questions

2010-08-16 Thread Neil Cerutti
On 2010-08-15, John Nagle wrote: > In retrospect, C's "pointer=array" concept was a terrible > mistake. C arrays are not pointers. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-16 Thread David Cournapeau
On Mon, Aug 16, 2010 at 9:53 AM, Gregory Ewing wrote: >> On Aug 7, 2010, at 9:14 PM, John Nagle wrote: >> >>>  The languages which have real multidimensional arrays, rather >>> than arrays of arrays, tend to use 1-based subscripts.  That >>> reflects standard practice in mathematics. > > Not alway

Re: Python "why" questions

2010-08-16 Thread Martin Gregorie
On Mon, 16 Aug 2010 12:33:51 +1200, Gregory Ewing wrote: > Ian Kelly wrote: >> On Fri, Aug 13, 2010 at 11:53 AM, Martin Gregorie >> wrote: > >>> real sample[-500:750]; > >> Ugh, no. The ability to change the minimum index is evil. > > Not always; it can have its uses, particularly when

Re: Python "why" questions

2010-08-16 Thread Steven D'Aprano
On Mon, 16 Aug 2010 16:28:46 +1200, Lawrence D'Oliveiro wrote: > In message <8crg0effb...@mid.individual.net>, Gregory Ewing wrote: > >> For example, the constant term of a polynomial is usually called term >> 0, not term 1. > > That is not some kind of ordinal numbering of the terms, that is th

Re: Python "why" questions

2010-08-15 Thread Bob Martin
in 639663 20100815 120123 Lawrence D'Oliveiro wrote: >In message , Ian Kelly >wrote: > >> The ability to change the minimum index is evil. > >Pascal allowed you to do that. And nobody ever characterized Pascal as >“evil”. Not for that reason, anyway... Why do you refer to Pascal in the past

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message <8crg0effb...@mid.individual.net>, Gregory Ewing wrote: > For example, the constant term of a polynomial is usually called term 0, > not term 1. That is not some kind of ordinal numbering of the terms, that is the power of the variable involved. And polynomials can have negative powe

Re: Python "why" questions

2010-08-15 Thread Roy Smith
In article <8crg0effb...@mid.individual.net>, Gregory Ewing wrote: > Not always -- mathematicians use whatever starting index is > most convenient for the problem at hand. Which may be 0, 1, or something else. There are plenty of situations, for example, where you might want to use both posit

Re: Python "why" questions

2010-08-15 Thread Gregory Ewing
On Aug 7, 2010, at 9:14 PM, John Nagle wrote: The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That reflects standard practice in mathematics. Not always -- mathematicians use whatever starting index is most convenient for

Re: Python "why" questions

2010-08-15 Thread Gregory Ewing
Roald de Vries wrote: On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: Which somewhat defeats the point of trying to make them look the same, don’t you think? How are they not the same? One way to see that they're not *exactly* the same is the fact that sizeof("python rocks") i

Re: Python "why" questions

2010-08-15 Thread Gregory Ewing
Ian Kelly wrote: On Fri, Aug 13, 2010 at 11:53 AM, Martin Gregorie wrote: real sample[-500:750]; Ugh, no. The ability to change the minimum index is evil. Not always; it can have its uses, particularly when you're using the array as a mapping rather than a collection. Pascal had

Re: Python "why" questions

2010-08-15 Thread John Nagle
On 8/15/2010 4:00 AM, Lawrence D'Oliveiro wrote: In message, Thomas Jollans wrote: "Where it all started" is that 0-based indexing gives languages like C a very nice property: a[i] and *(a+i) are equivalent in C. From a language design viewpoint, I think that's quite a strong argument. It wou

Re: Python "why" questions

2010-08-15 Thread Dave Angel
Roald de Vries wrote: On Aug 15, 2010, at 2:16 PM, geremy condra wrote: On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries wrote: On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: It would be if pointers and arrays were the same thing in C. Only they’re not, quite. Which somewhat defeats

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
On Aug 15, 2010, at 2:16 PM, geremy condra wrote: On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries wrote: On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: It would be if pointers and arrays were the same thing in C. Only they’re not, quite. Which somewhat defeats the point of trying

Re: Python "why" questions

2010-08-15 Thread geremy condra
On Sun, Aug 15, 2010 at 4:55 AM, Roald de Vries wrote: > On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: >> >> It would be if pointers and arrays were the same thing in C. Only they’re >> not, quite. Which somewhat defeats the point of trying to make them look >> the >> same, don’t you thi

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
On Aug 7, 2010, at 9:14 PM, John Nagle wrote: FORTRAN, MATLAB, and Octave all use 1-based subscripts. The languages which have real multidimensional arrays, rather than arrays of arrays, tend to use 1-based subscripts. That reflects standard practice in mathematics. True, but that somethi

Re: Python "why" questions

2010-08-15 Thread Roald de Vries
On Aug 15, 2010, at 1:00 PM, Lawrence D'Oliveiro wrote: It would be if pointers and arrays were the same thing in C. Only they’re not, quite. Which somewhat defeats the point of trying to make them look the same, don’t you think? How are they not the same? The code snippet (in C/C++) below

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message , Ian Kelly wrote: > The ability to change the minimum index is evil. Pascal allowed you to do that. And nobody ever characterized Pascal as “evil”. Not for that reason, anyway... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message , Thomas Jollans wrote: > "Where it all started" is that 0-based indexing gives languages like C a > very nice property: a[i] and *(a+i) are equivalent in C. From a language > design viewpoint, I think that's quite a strong argument. It would be if pointers and arrays were the same th

Re: Python "why" questions

2010-08-15 Thread Lawrence D'Oliveiro
In message <4c5db0ae$0$1641$742ec...@news.sonic.net>, John Nagle wrote: > The languages which have real multidimensional arrays, rather > than arrays of arrays, tend to use 1-based subscripts. That > reflects standard practice in mathematics. Actually I’d go one better, and say that the lang

Re: Python "why" questions

2010-08-13 Thread Ian Kelly
On Fri, Aug 13, 2010 at 11:53 AM, Martin Gregorie wrote: > In a higher level language 1-based indexing is just as limiting as 0- > based indexing. What you really want is the ability to declare the index > range to suit the problem: in Algol 60 it is very useful to be able to > declare something l

Re: Python "why" questions

2010-08-13 Thread Terry Reedy
On 8/13/2010 11:27 AM, Den wrote: I smile every time I see the non-nonsensical sentence "The first thing, therefore, is in thing[0]" in a programming language learning book or tutorial. I laugh every time I hear someone defend that as common sense. If one thinks in terms of slicing at gap po

Re: Python "why" questions

2010-08-13 Thread Lie Ryan
Sorry the message gets cuts off by an accidental press of send button. On 08/14/10 04:31, Lie Ryan wrote: > On 08/10/10 06:36, Bartc wrote: >> And if the context is Python, I doubt whether the choice of 0-based over a >> 1-based makes that much difference in execution speed. > > And I doubt anyo

Re: Python "why" questions

2010-08-13 Thread Lie Ryan
On 08/10/10 06:36, Bartc wrote: > And if the context is Python, I doubt whether the choice of 0-based over a > 1-based makes that much difference in execution speed. And I doubt anyone cares about execution speed when deciding whether to use 1-based or 0-based array. The reason why you want to ch

Re: Python "why" questions

2010-08-13 Thread Martin Gregorie
On Fri, 13 Aug 2010 19:14:44 +0200, Thomas Jollans wrote: > "Where it all started" is that 0-based indexing gives languages like C a > very nice property: a[i] and *(a+i) are equivalent in C. From a language > design viewpoint, I think that's quite a strong argument. Languages > based directly on

Re: Python "why" questions

2010-08-13 Thread Neil Cerutti
On 2010-08-13, Thomas Jollans wrote: > 1-based indexing might seam more intuitive, but in the end, > it's just another thing you have to learn when learning a > language, like "commas make tuples", and somebody studying a > programming language learns it, and gets used to it if they > aren't used

Re: Python "why" questions

2010-08-13 Thread Thomas Jollans
On 2010-08-13 17:27, Den wrote: > There may be loads of reasons for it, but don't throw common sense > around as one of them. > It's a good thing then that I didn't: >> ... However, the killer reason is: "it's what everybody >> else does. >> > "Where it all started" is that 0-based index

Re: Python "why" questions

2010-08-13 Thread Den
> ... However, the killer reason is: "it's what everybody > else does. If this were really true, lists would be 1-based. I go back to WATFOR; and Fortran (and I believe Cobol and PL/I, though I'm not positive about them) were 1-based. (Now that I think about it, PL/I, knowing IBM, could probably

Re: Python "why" questions

2010-08-12 Thread Hexamorph
Terry Reedy wrote: On 8/9/2010 11:16 AM, Grant Edwards wrote: Just for the record: I sincerely apologize for my rant. I usually don't loose control so heavily, but this "Rick" person makes me mad (killfile'd now) IOW, the "Ugly American". No! That's not what I said. I'm myself one of tho

Re: Python "why" questions

2010-08-10 Thread D'Arcy J.M. Cain
On Tue, 10 Aug 2010 13:51:17 +0200 Jean-Michel Pichavant wrote: Pardon the response to the response. I missed Ben's message. > Ben Finney wrote: > > "D'Arcy J.M. Cain" writes: > >> No. You are giving me math and logic but the subject was common > >> sense. > > > > Common sense is often unhelp

Re: Python "why" questions

2010-08-10 Thread Jean-Michel Pichavant
Ben Finney wrote: "D'Arcy J.M. Cain" writes: No. You are giving me math and logic but the subject was common sense. Common sense is often unhelpful, and in such cases the best way to teach something is to plainly contradict that common sense. Common sense, for example, would have t

Re: Python "why" questions

2010-08-09 Thread Bartc
"Nobody" wrote in message news:pan.2010.08.07.15.23.59.515...@nowhere.com... > On Sat, 07 Aug 2010 13:48:32 +0200, News123 wrote: > >>> "Common sense" is wrong. There are many compelling advantages to >>> numbering from zero instead of one: >>> >>> http://lambda-the-ultimate.org/node/1950 >> >

Re: Python "why" questions

2010-08-09 Thread Bartc
"D'Arcy J.M. Cain" wrote in message news:mailman.1735.1281185722.1673.python-l...@python.org... > On Sat, 07 Aug 2010 13:48:32 +0200 > News123 wrote: >> It makes sense in assembly language and even in many byte code languages. >> It makes sense if you look at the internal representation of unsi

Re: Python "why" questions

2010-08-09 Thread Grant Edwards
On 2010-08-09, Terry Reedy wrote: > On 8/9/2010 11:16 AM, Grant Edwards wrote: > >> IOW, the "Ugly American". > [snip hate rant] > > Stereotypically bashing "Americans" I wasn't bashing "Americans". I was making light of a certain type of American tourist commonly denoted by the phrase "ugly ame

Re: Python "why" questions

2010-08-09 Thread Terry Reedy
On 8/9/2010 11:16 AM, Grant Edwards wrote: IOW, the "Ugly American". [snip hate rant] Stereotypically bashing "Americans" is as ugly and obnoxious as bashing any other ethnic group. I have traveled the world and Americans are no worse, but are pretty much the same mix of good and bad. It is

Re: Python "why" questions

2010-08-09 Thread Grant Edwards
On 2010-08-07, Hexamorph wrote: > Lurking for long enough to know your style. Looking at your Unicode > rant, combined with some other comments and your general "I am right > and you are wrong because you disagree with me." style, I came to > the conclusion, that you are either a faschist or t

Re: Python "why" questions

2010-08-09 Thread saeed.gnu
> > 1)  Why do Python lists start with element [0], instead of element > > [1]?  "Common sense" would seem to suggest that lists should start > > with [1].   Because Zero is the neutral element of addition operation. And indexes (and all adresses in computing) involve with addition much more than

Re: Python "why" questions

2010-08-08 Thread Thomas Jollans
On 2010-08-08 05:18, Dennis Lee Bieber wrote: > Was it this thread where I commented that many early BASICs would > allocate an eleven element array on > > DIM A(10) VB.net does this -- to cater for the classic VB programmer who is used to being able to index the number in brackets, and the .

Re: Python "why" questions

2010-08-08 Thread MRAB
Default User wrote: Not to prolong a good "food fight", but IIRC, many years ago in QBasic, one could choose OPTION BASE 0 or OPTION BASE 1 to make arrays start with element [0] or element [1], respectively. Could such a feature be added to Python without significantly bloating the interpr

Re: Python "why" questions

2010-08-08 Thread Benjamin Kaplan
On Sun, Aug 8, 2010 at 10:24 AM, Default User wrote: > Not to prolong a good "food fight", but IIRC, many years ago in QBasic, > one could choose > > OPTION BASE 0 > > or > > OPTION BASE 1 > > to make arrays start with element [0] or element [1], respectively.  Could > such a feature be added to P

Re: Python "why" questions

2010-08-08 Thread Default User
Not to prolong a good "food fight", but IIRC, many years ago in QBasic, one could choose OPTION BASE 0 or OPTION BASE 1 to make arrays start with element [0] or element [1], respectively. Could such a feature be added to Python without significantly bloating the interpreter? Then, if starting

Re: Python "why" questions

2010-08-07 Thread Roy Smith
In article <7f3c505c-4002-427e-a969-6d735307e...@z10g2000yqb.googlegroups.com>, CM wrote: > > Apparently, the Japanese used to (before they started adopting western > > conventions). I.e. ages were given as "in his tenth year" (meaning nine > > years old). With apologies to Paul Simon... One

  1   2   >