Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-18 Thread Antoon Pardon
On 2007-04-14, Paddy <[EMAIL PROTECTED]> wrote: > On Apr 14, 11:27 am, [EMAIL PROTECTED] wrote: >> This is like the previous one. Please check for sanity and approve for >> posting at python-dev. >> >> I would like to have something like "option base" in Visual Basic. >> IIRC it used to allow me to

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-18 Thread Bjoern Schliessmann
Dustan wrote: > For newbies, it's easier to count starting with 1. It's rather > unintuitive to start at 0. Cool. So Python will become a "newbie language", and everyone that "jumps" from Python to a different language will have to relearn 0-based indices? ;) Regards, Björn -- BOFH excuse #

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-17 Thread Zara
On Mon, 16 Apr 2007 10:15:19 +0200, "Javier Bezos" <[EMAIL PROTECTED]> wrote: >Paddy, > >>> Dijkstra's argument is obsolete, as it is based on >>> how array length was computed many years ago -- if >>> we have an array a = b..e, then the lenght of a >>> is e-b (half open range). Good at low level

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-17 Thread Dustan
On Apr 14, 4:06 pm, Bjoern Schliessmann wrote: > jamadagni wrote: > > OK fine. It is clear that this feature must be implemented if at > > all only on a per-module basis. So can we have votes for > > per-module implementation of this feature? > > I don't think it's worth the hassle. BTW, what's, I

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-16 Thread Tim Roberts
"Beliavsky" <[EMAIL PROTECTED]> wrote: > >Fortran has allowed a user-specified base since at least the 1977 >standard -- see for example >http://www.umiacs.umd.edu/~jhu/DOCS/SP/docs/essl/essl159.html >. You can strike "at least"; this extension was introduced in FORTRAN 77. FORTRAN 66 didn't do t

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-16 Thread Javier Bezos
Paddy, >> Dijkstra's argument is obsolete, as it is based on >> how array length was computed many years ago -- if >> we have an array a = b..e, then the lenght of a >> is e-b (half open range). Good at low level >> programming. >> >> But a quarter of a century after we know concepts >> are much b

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Dan Bishop
On Apr 15, 6:06 pm, "Beliavsky" <[EMAIL PROTECTED]> wrote: > On Apr 14, 10:12 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > > > > > So the running count is: > > Ayes to the left: VB compatibility. > > Nays to the right: QuadIO, Perl, Dijkstra paper. > > > The nays have it! > > One-based indexing

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Beliavsky
On Apr 14, 10:12 pm, "Paddy" <[EMAIL PROTECTED]> wrote: > So the running count is: > Ayes to the left: VB compatibility. > Nays to the right: QuadIO, Perl, Dijkstra paper. > > The nays have it! One-based indexing would also Python more compatible with Fortran, Matlab/Octave/Scilab, and S

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Beliavsky
On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > The FORTRAN family had started as 1-based (F95, and Ada, now allow > for each array to have its own "base" => x : array (-10..10) of float). Fortran has allowed a user-specified base since at least the 1977 standard --

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Paddy
On Apr 15, 6:42 pm, "Javier Bezos" <[EMAIL PROTECTED]> wrote: > > Here is a document giving good reasons for indexing to start at > > zero, as in Python. > >http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html > > The author has done a bit: > >http://en.wikipedia.org/wiki/Dijkstra

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Javier Bezos
> Here is a document giving good reasons for indexing to start at > zero, as in Python. > http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html > The author has done a bit: > http://en.wikipedia.org/wiki/Dijkstra Dijkstra's argument is obsolete, as it is based on how array length

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Nick Craig-Wood
Sherm Pendley <[EMAIL PROTECTED]> wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > > Having more than one index start point would be a maintenance > > nightmare best avoided. > > Quite right. > > > (It can be done in Perl). > > When was the last time you used Perl? It was allowed in Perl 4 a

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 22:02:47 -0700, Alex Martelli wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> On Sat, 14 Apr 2007 20:34:46 -0700, Dan Bishop wrote: >> >> > On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >> > >> >> The FORTRAN family had started as 1-based

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Alex Martelli
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 14 Apr 2007 20:34:46 -0700, Dan Bishop wrote: > > > On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > >> The FORTRAN family had started as 1-based (F95, and Ada, now allow > >> for each array to have its own "base

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Steven D'Aprano
On Sat, 14 Apr 2007 20:34:46 -0700, Dan Bishop wrote: > On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > >> The FORTRAN family had started as 1-based (F95, and Ada, now allow >> for each array to have its own "base" => x : array (-10..10) of float). >> Pascal, I forget.

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Dan Bishop
On Apr 14, 10:55 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > The FORTRAN family had started as 1-based (F95, and Ada, now allow > for each array to have its own "base" => x : array (-10..10) of float). > Pascal, I forget... Pascal allows arbitrary array bases. It's where Ada got t

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Paddy
On Apr 15, 2:29 am, [EMAIL PROTECTED] (Alex Martelli) wrote: > Sherm Pendley <[EMAIL PROTECTED]> wrote: > > "Paddy" <[EMAIL PROTECTED]> writes: > > > > I don't think we should add it to Python > > > because it would make porting VB code easier. > > > Great Cthulhu no! > > > I chimed in because your

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Alex Martelli
Sherm Pendley <[EMAIL PROTECTED]> wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > > I don't think we should add it to Python > > because it would make porting VB code easier. > > Great Cthulhu no! > > I chimed in because your first comment regarding Perl implied that it's > commonplace for Per

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Alex Martelli
faulkner <[EMAIL PROTECTED]> wrote: ... > __future__ is used to access upcoming features, and changing the base > offset is not [and never will be] slated for future development. zero > has been used as the base offset in all real languages since the dawn > of time, and isn't something that can

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I would like to have something like "option base" in Visual Basic. | IIRC it used to allow me to choose whether 0 or 1 should be used as | the base of member indices of arrays. In Python, the same can be used | with strings, lists, tup

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Sherm Pendley
"Paddy" <[EMAIL PROTECTED]> writes: > I don't think we should add it to Python > because it would make porting VB code easier. Great Cthulhu no! I chimed in because your first comment regarding Perl implied that it's commonplace for Perl programmers to fiddle with the index base. It can be done,

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Bjoern Schliessmann
jamadagni wrote: > OK fine. It is clear that this feature must be implemented if at > all only on a per-module basis. So can we have votes for > per-module implementation of this feature? I don't think it's worth the hassle. BTW, what's, IYHO, the distinct advantage of starting array indices at 1

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Paddy
On Apr 14, 8:55 pm, Sherm Pendley <[EMAIL PROTECTED]> wrote: > "Paddy" <[EMAIL PROTECTED]> writes: > > Having more than one index start point would be a maintenance > > nightmare best avoided. > > Quite right. > > > (It can be done in Perl). > > When was the last time you used Perl? It was allowed

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread John Machin
On Apr 14, 8:27 pm, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of m

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Sherm Pendley
"Paddy" <[EMAIL PROTECTED]> writes: > Having more than one index start point would be a maintenance > nightmare best avoided. Quite right. > (It can be done in Perl). When was the last time you used Perl? It was allowed in Perl 4 and earlier, because many Perl users were moving from Awk, which

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Paddy
On Apr 14, 11:27 am, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread faulkner
On Apr 14, 6:27 am, [EMAIL PROTECTED] wrote: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. > > I would like to have something like "option base" in Visual Basic. > IIRC it used to allow me to choose whether 0 or 1 should be used as > the base of m

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Mel Wilson
jamadagni wrote: > OK fine. It is clear that this feature must be implemented if at all > only on a per-module basis. So can we have votes for per-module > implementation of this feature? The only way that can work is if the API to the module doesn't expose ANY sequence indices. It would be a gr

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread ici
On Apr 14, 1:27 pm, [EMAIL PROTECTED] wrote: ... > This would mean: > foo = "foo" > => foo[1] == 'f' > class Str1(str): def __getitem__(self,i): return str.__getitem__(self,i-1) s1 = Str1("foo") print s1[1] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Steve Holden
jamadagni wrote: >> Modules are parsed when they are imported. And some modules are already >> imported before your module is imported because they are built-in or >> loaded to be able to import your module in the first place. And what >> about modules that are written in C? > > OK fine. It is c

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread jamadagni
> Modules are parsed when they are imported. And some modules are already > imported before your module is imported because they are built-in or > loaded to be able to import your module in the first place. And what > about modules that are written in C? OK fine. It is clear that this feature mu

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, jamadagni wrote: > On Apr 14, 4:01 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >> This one is not sane. It's not possible to change the indexing of >> objects on a per-module basis, as objects may cross module boundaries. > > I do not request for this to be changed

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread jamadagni
On Apr 14, 4:01 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > This one is not sane. It's not possible to change the indexing of > objects on a per-module basis, as objects may cross module boundaries. I do not request for this to be changed per-module. Once I say something like: from __futu

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > This is like the previous one. Please check for sanity and approve for > posting at python-dev. This one is not sane. It's not possible to change the indexing of objects on a per-module basis, as objects may cross module boundaries. Suppose you have this code: option

Python Feature Request: Allow changing base of member indices to 1

2007-04-14 Thread samjnaa
This is like the previous one. Please check for sanity and approve for posting at python-dev. I would like to have something like "option base" in Visual Basic. IIRC it used to allow me to choose whether 0 or 1 should be used as the base of member indices of arrays. In Python, the same can be used