do...while loops

Will Ware wware at world.std.com
Tue Feb 6 21:41:14 CET 2001


Jay O'Connor (joconnor at cybermesa.com) wrote:
> I was just trying to think of a practical (?) use for doing a "while"
> loop with a number other than 1

It could make sense if the "increment" operation were something tricky
and convoluted. I dunno, maybe something like

x = some_value
while x > some_threshold:
  do stuff with x
  x = 0.8 ** math.cos(x)

If the series of x values can't easily be generated by plugging a
sequence of integers into a function, then you might have a case for
using while. You'd be lucky, though, if your terminating condition
were as simple as x != 0.

-- 
import string,time,os;print string.join((lambda x:x[:10]+x[8:])(map(
lambda x:string.center("*"*(lambda x:((x<24) ### Seasons Greetings, Will Ware
*(x-3))+3)(x),24),range(1,28, 2))),"\n") ################ wware at world.std.com



More information about the Python-list mailing list