[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
- Previous message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Next message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Next message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]