"do" as a keyword
Tommy Grav
tgrav at mac.com
Thu Dec 13 07:02:52 EST 2007
On Wed, 12 Dec 2007 09:46:09 -0600, Chris Mellon wrote:
> I agree that it's fundamental, but I'd like to mention that I've
> written
> many thousands of lines of Python code, from throwaway code for
> demonstration to enterprisey servers and all sorts of things in
> between
> and I've *never* written a "1 or more times" loop except when I was
> demonstrating that exact thing. One thing that Python has definitely
> changed my thinking about is that I tend to formulate both problems
> and
> solutions in terms of iteration over sequence rather than as
> traditional
> conditional based looping. If I need a "1 or more" loop I formulate
> the
> problem as a sequence of 1 or more elements.
How would you code an integrator-loop to stop when its error goes below
some limit with iterations? While loops are as far as I can tell
essential for
a number of problems in math and physics.
Cheers
TG
More information about the Python-list
mailing list