New submission from Dimitri Papadopoulos Orfanos:

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

----------
assignee: docs@python
components: Documentation
messages: 257418
nosy: Dimitri Papadopoulos Orfanos, docs@python
priority: normal
severity: normal
status: open
title: Tutorial: write() does not expect string in binary mode
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26001>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to