[issue15951] string.Formatter returns str for empty unicode template

Chris Jerdonek report at bugs.python.org
Sun Sep 16 15:55:30 CEST 2012


Chris Jerdonek added the comment:

Here are some related failing cases that I found:

>>> f = string.Formatter()
>>> f.format(u"{0}", "")
''
>>> f.format(u"{0}", 1)
'1'
>>> f.format(u"{0}", "a")
'a'
>>> f.format(u"{0}{1}", "a", "b")
'ab'
>>> f.format("{0}", u"a") 
u'a'

Note that PEP 3101 says the following:

"In all cases, the type of the format string dominates - that
is, the result of the conversion will always result in an object
that contains the same representation of characters as the
input format string."

----------

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


More information about the Python-bugs-list mailing list