This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author fornax
Recipients Zero, benjamin.peterson, docs@python, eryksun, fornax, pitrou, serhiy.storchaka, steve.dower, stutzbach, vstinner
Date 2016-01-19.19:38:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453232295.89.0.586887454079.issue26158@psf.upfronthosting.co.za>
In-reply-to
Content
Another surprising result:

>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.write('test')
4
>>> f.close()
>>> open('temp.txt').read()
'testE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n'

>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n')
32
>>> f = open('temp.txt', 'r+')
>>> f.write('test')
4
>>> f.read(1)
'A'
>>> f.close()
>>> open('temp.txt').read()
'ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\ntest'

The position of the write in the file depends on whether or not there is a subsequent read.
History
Date User Action Args
2016-01-19 19:38:15fornaxsetrecipients: + fornax, pitrou, vstinner, benjamin.peterson, stutzbach, Zero, docs@python, serhiy.storchaka, eryksun, steve.dower
2016-01-19 19:38:15fornaxsetmessageid: <1453232295.89.0.586887454079.issue26158@psf.upfronthosting.co.za>
2016-01-19 19:38:15fornaxlinkissue26158 messages
2016-01-19 19:38:15fornaxcreate