creating generators from function

Isaac To iketo2 at netscape.net
Thu Dec 9 01:07:21 EST 2004


>>>>> "Mike" == Mike Meyer <mwm at mired.org> writes:

    Mike> I think it's a bit abnormal, because you have to scan the
    Mike> loop body for breaks. I tend to write:

    Mike> condition = True
    Mike> while condition:  # corrected
    Mike>     #code which iterates my simulation

Then you'd have to scan the loop body to find the location where
condition is set, which is more difficult than locating breaks
normally.  If you get a break, you really breaks.  If you set
condition to False, you still might be modifying it to True later in
your code.  And of course, most editors will highlight the "break" for
you, while no editor will highlight for you the "condition" variable
that you are staring at.

Regards,
Isaac.



More information about the Python-list mailing list