[Python-3000] PEP: rename it.next() to it.next(), add a next() built-in (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 6 00:31:34 CET 2007


Georg Brandl wrote:

Indeed, you almost always have to have a try-except StopIteration- wrapper around "manual" calls to .next().

An alternative way of addressing this would be to have a new control structure. We already have the 'for' statement for when you want all the values; why not another one for when you just want one value? Maybe something like

get item from iter: # code for when we got something else: # code for when we didn't get anything

-- Greg



More information about the Python-3000 mailing list