[docs] [issue12434] Strengthen 2.7 io types warning

Terry J. Reedy report at bugs.python.org
Tue Jun 28 21:22:58 CEST 2011


New submission from Terry J. Reedy <tjreedy at udel.edu>:

Trying 3.2 code with 2.7, I got this (greatly simplified):

from __future__ import print_function
from io import StringIO
print('hello world', file=StringIO())
Traceback...
TypeError: string argument expected, got 'str'
(StringIO.StringIO works fine, of course.)

This was initially confusing. Suggestion: after

"Note Since this module has been designed primarily for Python 3.x, you have to be aware that all uses of “bytes” in this document refer to the str type (of which bytes is an alias), and all uses of “text” refer to the unicode type. "
add
'String' in exception messages may also mean the unicode type."

----------
assignee: docs at python
components: Documentation
keywords: easy
messages: 139374
nosy: docs at python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Strengthen 2.7 io types warning
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12434>
_______________________________________


More information about the docs mailing list