R. David Murray <rdmur...@bitdance.com> added the comment:

>>> print('{}'.format(u'\u2107'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2107' in position 
0: ordinal not in range(128)
>>> print('%s' % u'\u2107')
ℇ

(You get the exception without the print as well, just in case that isn't 
clear.)

Ah, and now I see why this is true.  The '%s' gets implicitly coerced to 
unicode.  So, it is not a bug in format, and the yield statement change should 
be reverted.

You can use format if you just always make your format input strings unicode 
strings (which you should be doing anyway, especially now that python3.3 will 
allow the 'u' prefix...that is, such code will be forward-compatible with 
Python3).

----------

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

Reply via email to