Op 2005-04-21, Dan Bishop schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2005-04-21, Steve Holden schreef <[EMAIL PROTECTED]>:
>> > [EMAIL PROTECTED] wrote:
> ...
>> >> Along the same lines, I think the REQUIREMENT that x[0] rather
> than
>> >> x[1] be the first element of list x is a mistake. At least the
>> >> programmer should have a choice, as in Fortran or VBA. In C
> starting at
>> >> 0 may be justified because of the connection between array
> subscripting
>> >> and pointer arithmetic, but Python is a higher-level language
> where
>> >> such considerations are less relevant.
>> >>
>> > But Pythonicity required that there should be one obvious way to do
>
>> > something. How obvious is having two ways?
>>
>> How obvious is that lists can be any length? Do you consider it
>> an unbounded number of ways, that lists can be any length?
>>
>> Like users have a choice in how long they make a list, they
>> should have a choice where the indexes start. (And that
>> shouldn't be limited to 0 and 1).
>
> Suppose you could.  Then what should
>
> ([3, 1, 4] indexbase 0) + ([1, 5, 9] indexbase 4)
>
> equal?

There are multiple possibilities, that can make sense.
I'm sure that no consensus will be reached about what
is should be. This will stop this idea from ever being
implemented. So you shouldn't worry too much about it :-).

>> That you are forced to use zero-based structures, while the
>> problem space you are working on uses one-based structures
>> is a far bigger stumbling block where you continually have
>> to be aware that the indexes in your program are one off
>> from the indexes the problem is expressed in.
>
> Name a problem space that inherently requires arrays to be 1-based
> rather than 0-based.

None, but that is beside the question. If I look into my mathematics
books plenty of problems are described in terms of one based indexes
Sure most of them could just as easily be described in terms of
zero-based indexes, but the fact of the matter is they are not.

The same goes for problems other people would like me to solve.
Often enough they describe their problems in term of 1-based
indexes rather than 0-based. Sure I can translate it to 0-based,
but that will just make communication between me and the client
more difficult.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to