Terry J. Reedy <[email protected]> added the comment:
OS and disk interaction is not something I know a lot about. I don't know how
long different OSes take to write things out by themselves, and therefore how
much real danger there is of loosing data. However, IDLE is used in places
where power is less reliable than it is for me, and if not doing this makes
IDLE look bad, and if it does not noticeably delay running a file (and I expect
not), then it seems like a good idea.
Digging further, Kurt Kaiser added f.flush in 3/19/2006. On 2013-08-04, for
#18151, Serhiy submitted a patch for 3.3 with the comment "Here is a patch
which replace the "open ... close" idiom to the "with open" idiom in IDLE." It
replaced
f = open(filename, "wb")
f.write(chars)
f.flush()
f.close()
with
with open(filename, "wb") as f:
f.write(chars)
I have no idea why f.flush was deleted. An oversight? There is no discussion
on the issue. I merged Serhiy's patch and backported to 2.7.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue36807>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com