[EMAIL PROTECTED] wrote:

What's the best Python idiom for this C construct?

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

iter is your friend:

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

details:

>>> help(iter)
Help on built-in function iter in module __builtin__:

iter(...)
    iter(collection) -> iterator
    iter(callable, sentinel) -> iterator

    Get an iterator from an object.  In the first form, the
    argument must supply its own iterator, or be a sequence.
    In the second form, the callable is called until it
    returns the sentinel.

</F>

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

Reply via email to