New submission from Terry J. Reedy <tjre...@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@python
components: Documentation
keywords: easy
messages: 139374
nosy: docs@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue12434>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to