[issue8401] Strange behavior of bytearray slice assignment

Eugene Kapun report at bugs.python.org
Fri Apr 16 09:27:15 CEST 2010


Eugene Kapun <abacabadabacaba at gmail.com> added the comment:

Empty string is an iterable of integers in the range 0 <= x < 256, so it should be allowed.

>>> all(isinstance(x, int) and 0 <= x < 256 for x in "")
True
>>> bytearray()[:] = ""
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: string argument without an encoding

----------

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


More information about the Python-bugs-list mailing list