[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

py.user report at bugs.python.org
Wed Jun 22 00:18:55 CEST 2011


py.user <port139 at yandex.ru> added the comment:

all other methods support it and it's right

>>> barr = bytearray(b'abcd*')
>>> barr.center(len(barr) * 4, barr[-1:])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: must be a byte string of length 1, not bytearray
>>> b = b'abcd*'
>>> b.center(len(b) * 4, b[-1:])
b'*******abcd*********'
>>>

----------

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


More information about the Python-bugs-list mailing list