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 Dimitri Papadopoulos Orfanos
Recipients Dimitri Papadopoulos Orfanos, docs@python
Date 2016-01-03.13:56:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1451829375.45.0.0188699168911.issue26001@psf.upfronthosting.co.za>
In-reply-to
Content
About section "7.2.1. Methods of File Objects" of the tutorial:


1. Method read() is documented as follows:
reads some quantity of data and returns it as a string or bytes object.

Indeed read() returns a string in text mode and bytes in binary mode. For the sake of clarity, I suggest changing to:

reads some quantity of data and returns it as a string (in text mode) or bytes object (in binary mode).

This might seem long-winded but I believe it would help those moving from Python 2 to Python 3.


2. Method write() is documented as follows:

To write something other than a string, it needs to be converted to a string first

While this is correct in text mode, it is wrong in binary mode. May I suggest:

To write something other than a string (in text mode) or bytes object (in binary mode), it needs to be converted first
History
Date User Action Args
2016-01-03 13:56:15Dimitri Papadopoulos Orfanossetrecipients: + Dimitri Papadopoulos Orfanos, docs@python
2016-01-03 13:56:15Dimitri Papadopoulos Orfanossetmessageid: <1451829375.45.0.0188699168911.issue26001@psf.upfronthosting.co.za>
2016-01-03 13:56:15Dimitri Papadopoulos Orfanoslinkissue26001 messages
2016-01-03 13:56:14Dimitri Papadopoulos Orfanoscreate