Best idiom for looping over input?

mh at pixar.com mh at pixar.com
Tue Aug 26 12:42:30 EDT 2008


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 ...

Many TIA!
Mark

-- 
Mark Harrison
Pixar Animation Studios



More information about the Python-list mailing list