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.

classification
Title: small addition to print() docs: no binary streams.
Type: enhancement Stage: resolved
Components: Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: georg.brandl, python-dev, terry.reedy
Priority: normal Keywords: patch

Created on 2014-09-25 07:02 by georg.brandl, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
print_binary.diff georg.brandl, 2014-09-25 07:02 review
print-22492-34.diff terry.reedy, 2014-09-30 23:49 review
Messages (4)
msg227509 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-09-25 07:02
This is implicit in the "converts arguments to strings", but people might reasonably expect that print(x, file=y) is the same as y.write(x) for strings and bytes.  This paragraph makes it clear.
msg228037 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-09-30 23:49
Agreed. Here is a patch I will commit if you approve.  I deleted 'convenience function' as distracting, labelled *file* a *text* stream in the first line, and added the rest of the comment after the current 'file' sentence, making separate 'file' and 'flush' paragraphs.

I unstarred 'file' in the addition to try to make it slightly clearer that the comment applies to the default sys.stdout, when rebound to a binary mode file, as well as to explicit *file=* arguments.
msg228064 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-10-01 09:38
Looks good.

> sys.stdout, when rebound to a binary mode file

Not sure that is supported in any way :)
msg228110 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-10-01 19:40
New changeset 9b519f72860a by Terry Jan Reedy in branch '3.4':
Issue 22492: Be explicit that print does not support binary mode files.
https://hg.python.org/cpython/rev/9b519f72860a
History
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66682
2014-10-01 19:40:58terry.reedysetstatus: open -> closed
assignee: terry.reedy
resolution: fixed
stage: commit review -> resolved
2014-10-01 19:40:17python-devsetnosy: + python-dev
messages: + msg228110
2014-10-01 09:38:39georg.brandlsetmessages: + msg228064
2014-09-30 23:49:59terry.reedysetfiles: + print-22492-34.diff

type: enhancement
versions: + Python 3.4, Python 3.5
nosy: + terry.reedy

messages: + msg228037
stage: commit review
2014-09-25 07:02:28georg.brandlcreate