creating generators from function
Mike Meyer
mwm at mired.org
Wed Dec 8 22:41:06 EST 2004
Simon Wittber <simonwittber at gmail.com> writes:
>> A function containing an infinite loop will never return, so it is bugged
>> and useless unless it does has an external effect with something like
>> 'print xxx' within the loop.
>
> I thought the idiom:
>
> while True:
> #code which iterates my simulation
> if condition: break
>
> wat quite normal. This is the style loop I am using.
I think it's a bit abnormal, because you have to scan the loop body
for breaks. I tend to write:
condition = True
while not condition:
#code which iterates my simulation
But that's just me.
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
More information about the Python-list
mailing list