[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 ?
In the first iteration, i is set equal to 10. Then, before
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 iteration, i is incremented
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 is set equal to 10. Then, before starting the
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
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/xrange, and
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 while
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 it
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
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
--
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 variable
has
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
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)
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 translated to Python
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 don't disagree
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
--
BOFH excuse
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 that
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 condition is
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...
for
18 matches
Mail list logo