array next pointer

Hrvoje Niksic hniksic at
Wed Mar 18 10:10:03 CET 2009

Armin <feng.shaun at> writes:

>> Yep, that's what I meant, I forgot the parameter name.
> Could you give an example of next() with a sentinel and describe its
> use case please?  I have a little trouble understanding what you
> guys mean!

See the thread about reading the file in chunks.  Instead of:

while True:
    chunk =
    if chunk == '':
    # your processing here

with sentinel iter, you can write:

for chunk in iter(lambda:, ''):
    # your processing here

More information about the Python-list mailing list