Commit 11fa0e48 authored by Cristian Ciupitu's avatar Cristian Ciupitu Committed by Serhiy Storchaka

Doc: fix example for iter() function. (GH-11959)

read() returns bytes for a file opened in binary mode,
so b'' should be used as a sentinel instead of ''.
Otherwise the loop will be infinite.
parent ebc793d6
......@@ -816,7 +816,7 @@ are always available. They are listed here in alphabetical order.
from functools import partial
with open('mydata.db', 'rb') as f:
for block in iter(partial(f.read, 64), ''):
for block in iter(partial(f.read, 64), b''):
process_block(block)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment