Author aroberge
Recipients aroberge
Date 2008-01-09.12:52:27
SpamBayes Score 0.0182826
Marked as misclassified No
Message-id <1199883149.22.0.23332594805.issue1775@psf.upfronthosting.co.za>
In-reply-to
Content
According to the docs, and consistent with the Python 2.x behavior,
filehandle.write() should return None.  However, under 3.0a2 (and
3.0a1), it returns the number of characters written.

Either the documentation
http://docs.python.org/dev/3.0/tutorial/inputoutput.html#reading-and-writing-files
is wrong, or it is a bug.  I would *much* prefer if the behavior would
stay the same as before.

Below is a sample session illustrating the behavior.  Note that I also
get an error message when exiting the session using exit() - this is an
unrelated problem.

Python 3.0a2 (r30a2:59382, Dec 27 2007, 15:48:14) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> handle = open('test_file.txt.', 'w')
>>> handle.write('spam')
4
>>> r = handle.write('more spam')
>>> print(r)
9
>>> exit()
/usr/local/py3k/lib/python3.0/io.py:1210: RuntimeWarning: Trying to
close unclosable fd!
  self.buffer.close()
History
Date User Action Args
2008-01-09 12:52:29arobergesetspambayes_score: 0.0182826 -> 0.0182826
recipients: + aroberge
2008-01-09 12:52:29arobergesetspambayes_score: 0.0182826 -> 0.0182826
messageid: <1199883149.22.0.23332594805.issue1775@psf.upfronthosting.co.za>
2008-01-09 12:52:28arobergelinkissue1775 messages
2008-01-09 12:52:27arobergecreate