On 01 Apr 2009 08:06:28 GMT, Steven D'Aprano
wrote:
>
>There are advantages and disadvantages to both systems, but on balance, I
>think that zero-based is a better system for programming, and one-based
>for natural language.
Nicely put.
Yes, along with some of your other arguments, I think I
On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks
wrote:
>
>Lada,
>
>I am also an engineer, and I can tell your idea of intuitive is not
>universal, even among engineers. I certainly do not lean toward one-
>based indexing.
>
>From a programming standpoint--and remember Python is a programming
On Wed, 01 Apr 2009 03:59:36 +0100, "Rhodri James"
wrote:
>
>Two opportunities to forget to lie about how big your array is :-)
It is rank 3, meaning a33 is the last element. I don't see how any
alternative can be simpler than that.
>
>> I wrote in my other post, 0 is weird to me, I have model o
On Tue, 31 Mar 2009 19:30:15 -0700 (PDT), woo...@gmail.com wrote:
>Counting from zero through n-1 is used because it is the memory offset
>and not any kind of counter. Simplified, if you are iterating through
>a list, using a for loop or anything else, the first element/number is
>at memory offse
On Tue, 31 Mar 2009 19:29:56 -0700, Chris Rebert
wrote:
>Sort of, but it's *really* not idiomatic. You'd have to declare the
>arrays to be one longer than they actually are so that array[N] is a
>valid index. And then you'd end up not using the true first element of
>the array. Not to mention mo
On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano
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/us
On Tue, 31 Mar 2009 21:13:05 -0400 (CLT), "andrew cooke"
wrote:
>Lada Kugis wrote:
>> I'm coming from fortran and
> *** c ***
>> background so I'm certainly biased by
>> them. But if you could explain one thing to me:
>
>but
On Tue, 31 Mar 2009 18:05:19 -0700, Gary Herron
wrote:
>This debate has been around for decades, in both mathematics and
>programming.
>
>Should a loop through n things use indices
>1, 2, ..., n
>or
>0, 1, ..., n-1 ?
>
>Fortran tends to go with the former (1-based indices) , while moder
On Wed, 01 Apr 2009 11:42:20 +1100, Ben Finney
wrote:
>Lada Kugis writes:
>
>> in python for example:
>> for i in range(1,n)
>> goes from 1,2,3,4,...,n-1
>> (that is, it goes from 1 up to, but not including n)
>
>Also, ?range(n)? counts from 0 to n-1.
>
On Wed, 01 Apr 2009 02:24:45 +0200, Lada Kugis
wrote:
>I'm coming from fortran and c background so I'm certainly biased by
>them. But if you could explain one thing to me:
>
>in fortran for example:
>for i=1,n
>goes from 1,2,3,4,...,n
And of course, lapsus calami, th
I'm coming from fortran and c background so I'm certainly biased by
them. But if you could explain one thing to me:
in fortran for example:
for i=1,n
goes from 1,2,3,4,...,n
in python for example:
for i in range(1,n)
goes from 1,2,3,4,...,n-1
(that is, it goes from 1 up to, but not including n)
On 21 Mar 2009 03:34:18 GMT, Steven D'Aprano
wrote:
Hello Steven,
thanks for answering on such short notice,
>
>Floats in Python don't have infinite precision.
>
>Ints (or longs) can have infinite precision. Try calculating (say)
>1234567**315*24689 and you should get 1923 digits. By the way, yo
I'm a newbie learning python, so forgive for, what may seem to some,
like a stupid question.
I understand the basic integer and fp type, but what I'm having a
little trouble are the long type and infinite precision type.
Also, when I do
>>> math.pi - (math.sqrt(math.pi))**2.
I get
>>>4.4408920
13 matches
Mail list logo