On Tue, 26 Aug 2008 16:42:30 GMT, [EMAIL PROTECTED] wrote:
What's the best Python idiom for this C construct?

   while ((x = next()) != END) {
       ....
   }

Now I'm doing

   x = next()
   while x != END:
       ....
       x = next()

There's not an iterator for this function, or I would
just use

   for x in ...


Use the magical second parameter to the `iter“ builtin:

   for x in iter(next, END):
       ...

Jean-Paul
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to