[issue3446] center, ljust and rjust are inconsistent with unicode parameters
STINNER Victor
report at bugs.python.org
Tue Mar 17 13:11:06 CET 2009
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
About Python3, bytes.center accepts unicode as second argument, which
is an error for me:
>>> b"x".center(5, b"\xe9")
b'\xe9\xe9x\xe9\xe9'
>>> b"x".center(5, "\xe9")
b'\xe9\xe9x\xe9\xe9'
The second example must fail with a TypeError.
str.center has the right behaviour:
>>> "x".center(5, "\xe9")
'ééxéé'
>>> "x".center(5, b"\xe9")
TypeError: The fill character cannot be converted to Unicode
----------
nosy: +haypo
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3446>
_______________________________________
More information about the Python-bugs-list
mailing list