Newbie getting desperate with for

Noah Hall enalicho at gmail.com
Fri Feb 18 18:06:09 CET 2011


On Fri, Feb 18, 2011 at 4:54 PM, Michael Torrie <torriem at gmail.com> wrote:
> On 02/17/2011 04:10 PM, Werner wrote:
> Just for your information, your code is the equivalent of:
>
> while True:
>    temp = range(20000000)
>
> The for loop does absolutely nothing in your case.  After the range is
> computed, the for loop exits on the first iteration.

Ah, but the for loop is there for a reason, I imagine. It'd certainly
be slower per while loop.



More information about the Python-list mailing list