Last active
August 29, 2015 14:01
-
-
Save markrwilliams/34b32ba8e8bb6bacf080 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import io | |
FN = 'thefile' | |
with open(FN, 'w') as f: | |
f.write(b'abcdefgh\n' | |
b'ijlkmnop\n' | |
b'qrstuwxyz\n') | |
with io.open(FN, mode='rb', buffering=4096) as f: | |
assert isinstance(f, io.BufferedReader) | |
f.readlines() | |
os.unlink(FN) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should see the same behavior with
buffering=1