[issue12606] Mutable Sequence Type works different for lists and bytearrays in slice[i:j:k]

py.user report at bugs.python.org
Fri Jul 22 02:22:45 CEST 2011


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

> I happen to prefer del myself
> but I agree that the two mutable sequence classes should behave the same.

del is not so flexible as assignement

>>> cmpr = [bytearray(i.encode('ascii')) for i in ('abcd', 'efgh', 'ijkl')]
>>> cmpr
[bytearray(b'abcd'), bytearray(b'efgh'), bytearray(b'ijkl')]
>>> cmpr[0][::-2] = cmpr[1][::2] = cmpr[2][1::2] = ()
>>> cmpr
[bytearray(b'ac'), bytearray(b'fh'), bytearray(b'ik')]
>>>

----------

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


More information about the Python-bugs-list mailing list