for loop

Diez B. Roggisch deetsNOSPAM at web.de
Sun Dec 12 19:04:03 CET 2004


> for i in range(morethanzero, n):
>      ...
> 
>> for i= 5 to len(var)
> 
> for i in range(5, len(var)):
>      ...

Better use xrange - it doesn't create an actual list, but instead an
iterator enumerating the elements. That way more memory and cpu efficient.
-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list