why I don't like range/xrange
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Fri Feb 16 12:07:07 EST 2007
In <pan.2007.02.16.16.17.27.576715 at REMOVE.THIS.cybersource.com.au>, 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 no effect on the "loop test". Which IMHO is a good thing.
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list