Armin <[email protected]> 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 = f.read(1024)
if chunk == '':
break
# your processing here
with sentinel iter, you can write:
for chunk in iter(lambda: f.read(1024), ''):
# your processing here
--
http://mail.python.org/mailman/listinfo/python-list