By "module" I assume you mean a Python product? Python has a while statement: ---------- while test: action ---------- Honestly, though, there's almost no good reason to use it. :-) While does little that couldn't be handled better by a for statement or a list comprehension. Mostly it's there for buzzword compliance. For example, if you've got a dictionary of records, it's quite easy to step through each one and perform some action: --------- for record in records.keys(): do_something(records[record]) --------- Or use a list comprehension: --------- [do_something(records[record]) for record in records.keys()] --------- When you've got options like that why would you prefer: --------- rst_size = len(records.keys()) i = 0 while i < rst_size: do something(records[i]) i += 1 --------- If you're still having trouble seeing how to do what you need to, it would be helpful to know a bit more about what you're attempting, what you've tried, and what isn't working about your solution. HTH, Dylan On Wed, 2003-05-21 at 12:55, McDonnell, Larry wrote:
Hi,
I have been searching for a while but I am coming up empty. I am writing a module that needs to create a block of records in the db so they can be updated at a later time. In the good old days, I would use a do while loop (do something while x < 10). How can this be done? And as always any pointers will be appreciated, thanks.
Larry McDonnell
Proton Energy Systems 10 Technology Drive Wallingford, CT 06492 (203) 678-2181 Email:lmcdonnell@protonenergy.com www.protonenergy.com
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )