[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 00:31:35 CEST 2011


New submission from py.user <port139 at yandex.ru>:

>>> barr = bytearray(b'abcde')
>>> lst = list('abcde')
>>> barr[::-3] = ()
>>> barr
bytearray(b'acd')
>>> lst[::-3] = ()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: attempt to assign sequence of size 0 to extended slice of size 2
>>> del lst[::-3]
>>> lst
['a', 'c', 'd']
>>>

lst[::-3] = () - is more convenient way for deletion

----------
components: Interpreter Core
messages: 140832
nosy: py.user
priority: normal
severity: normal
status: open
title: Mutable Sequence Type works different for lists and bytearrays in slice[i:j:k]
type: behavior
versions: Python 3.1

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


More information about the Python-bugs-list mailing list