Re: why I don't like range/xrange

2007-02-18 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Bruno Desthuilliers wrote: > >>Roel Schroeven a ecrit : >> >>>Bruno Desthuilliers schreef: >>> >>> stdazi a ecrit : >>> >>> >for (i = 0 ; i < 10 ; i++) > i = 10; for i in range(10): i = 10 What's your point, exactly ? >>> >>

Re: why I don't like range/xrange

2007-02-17 Thread [EMAIL PROTECTED]
Bruno Desthuilliers wrote: > Roel Schroeven a ecrit : > > Bruno Desthuilliers schreef: > > > >> stdazi a ecrit : > > > > > >>> for (i = 0 ; i < 10 ; i++) > >>>i = 10; > >> > >> > >> for i in range(10): > >>i = 10 > >> > >> What's your point, exactly ? > > > > > > In the first iteration, i i

Re: why I don't like range/xrange

2007-02-17 Thread Bruno Desthuilliers
Roel Schroeven a écrit : > Bruno Desthuilliers schreef: > >> stdazi a écrit : > > >>> for (i = 0 ; i < 10 ; i++) >>>i = 10; >> >> >> for i in range(10): >>i = 10 >> >> What's your point, exactly ? > > > In the first iteration, i is set equal to 10. Then, before starting the > second i

Re: why I don't like range/xrange

2007-02-16 Thread Samuel Karl Peterson
Roel Schroeven <[EMAIL PROTECTED]> on Sat, 17 Feb 2007 01:31:13 GMT didst step forth and proclaim thus: ... > So, the point is that in C you can influence the loop's behavior by > modifying the loop variable, while you cannot do that in Python (at > least not in a for-loop). What's wrong with...

Re: why I don't like range/xrange

2007-02-16 Thread Roel Schroeven
Bruno Desthuilliers schreef: > stdazi a écrit : >> for (i = 0 ; i < 10 ; i++) >>i = 10; > > for i in range(10): >i = 10 > > What's your point, exactly ? In the first iteration, i is set equal to 10. Then, before starting the second iteration, i is incremented to 11; then the loop condi

Re: why I don't like range/xrange

2007-02-16 Thread Bruno Desthuilliers
stdazi a écrit : > Hello! > > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, after > calculating the overhead (and losen flexibility) when working with > range/xrange, and while loops, you get to the conclusion t

Re: why I don't like range/xrange

2007-02-16 Thread Bjoern Schliessmann
Eduardo "EdCrypt" O. Padoan wrote: >> But this long int => int issue should not exist in a future >> python version any more, IIRC int and long int is scheduled to be >> merged somehow. (Or isn't it?) > > It is done. Thanks for the info. Please don't send mail copies! Regards, Björn -- BOF

Re: why I don't like range/xrange

2007-02-16 Thread Roger Miller
On Feb 16, 7:01 am, "Bart Ogryczak" <[EMAIL PROTECTED]> wrote: > On Feb 16, 4:30 pm, "stdazi" <[EMAIL PROTECTED]> wrote: > > > for (i = 0; some_function() /* or other condition */ ; i++) > > C's "for(pre,cond,post) code" is nothing more, then shorthand form of > "pre; while(cond) {code; post;}" I

Re: why I don't like range/xrange

2007-02-16 Thread Neil Cerutti
On 2007-02-16, Bart Ogryczak <[EMAIL PROTECTED]> wrote: > On Feb 16, 4:30 pm, "stdazi" <[EMAIL PROTECTED]> wrote: > >> for (i = 0; some_function() /* or other condition */ ; i++) > > C's "for(pre,cond,post) code" is nothing more, then shorthand form of > "pre; while(cond) {code; post;}" > Which tra

Re: why I don't like range/xrange

2007-02-16 Thread Eduardo \"EdCrypt\" O. Padoan
> But this long int => int issue should not exist in a future python > version any more, IIRC int and long int is scheduled to be merged > somehow. (Or isn't it?) It is done. http://mail.python.org/pipermail/python-3000-checkins/2007-January/000251.html -- EduardoOPadoan (eopadoan->altavix::com

Re: why I don't like range/xrange

2007-02-16 Thread Bjoern Schliessmann
stdazi wrote: > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, > after calculating the overhead (and losen flexibility) when > working with range/xrange, and while loops, you get to the > conclusion that it isn't

Re: why I don't like range/xrange

2007-02-16 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Steven D'Aprano wrote: >> for (i = 0 ; i < 10 ; i++) >>i = 10; > > > This would be written in Python as: > > for i in xrange(10): > i = 10 Nope, in Python it's: for i in xrange(10): break I think his example should demonstrate that assigning to the loop va

Re: why I don't like range/xrange

2007-02-16 Thread Bart Ogryczak
On Feb 16, 4:30 pm, "stdazi" <[EMAIL PROTECTED]> wrote: > for (i = 0; some_function() /* or other condition */ ; i++) C's "for(pre,cond,post) code" is nothing more, then shorthand form of "pre; while(cond) {code; post;}" Which translated to Python would be: pre while cond: code post -- h

Re: why I don't like range/xrange

2007-02-16 Thread Steven D'Aprano
On Fri, 16 Feb 2007 07:30:15 -0800, stdazi wrote: > Hello! > > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, after > calculating the overhead (and losen flexibility) when working with > range/xrange, and while

Re: why I don't like range/xrange

2007-02-16 Thread Larry Bates
stdazi wrote: > Hello! > > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, after > calculating the overhead (and losen flexibility) when working with > range/xrange, and while loops, you get to the conclusion that

Re: why I don't like range/xrange

2007-02-16 Thread Paul McGuire
On Feb 16, 9:30 am, "stdazi" <[EMAIL PROTECTED]> wrote: > Hello! > > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, after > calculating the overhead (and losen flexibility) when working with > range/xrange, and wh

Re: why I don't like range/xrange

2007-02-16 Thread Chris Mellon
On 16 Feb 2007 07:30:15 -0800, stdazi <[EMAIL PROTECTED]> wrote: > Hello! > > Many times I was suggested to use xrange and range instead of the > while constructs, and indeed, they are quite more elegant - but, after > calculating the overhead (and losen flexibility) when working with > range/xrang

why I don't like range/xrange

2007-02-16 Thread stdazi
Hello! Many times I was suggested to use xrange and range instead of the while constructs, and indeed, they are quite more elegant - but, after calculating the overhead (and losen flexibility) when working with range/xrange, and while loops, you get to the conclusion that it isn't really worth usi