This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: Mutable Sequence Type in .remove() is consistent only with lists, but not with bytearrays
类型: behavior Stage:
Components: Documentation, Interpreter Core Versions: Python 3.1
process
状态: closed Resolution:
Dependencies: 后续: index() and count() methods of bytes and bytearray should accept byte ints
View: 12170
分配给: docs@python 抄送列表: docs@python, petri.lehtinen, py.user
优先级: normal 关键字:

Created on 2011-07-25 00:26 by py.user, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg141066 - (view) Author: py.user (py.user) * 日期: 2011-07-25 00:26
4.6.4 Mutable Sequence Types

|  s.remove(x)  |  same as del s[s.index(x)]  |


>>> b = bytearray()
>>> b.extend(range(1, 6))
>>> b
bytearray(b'\x01\x02\x03\x04\x05')
>>> b.remove(2)
>>> del b[b.index(2)]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Type int doesn't support the buffer API
>>>
msg141218 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) 日期: 2011-07-27 10:45
Duplicate of issue 12170.
历史
日期 用户 动作 参数
2022-04-11 14:57:20admin修改github: 56840
2011-08-01 06:46:31petri.lehtinen修改状态: open -> closed
2011-07-27 10:45:14petri.lehtinen修改后续: index() and count() methods of bytes and bytearray should accept byte ints

消息: + msg141218
抄送: + petri.lehtinen
2011-07-25 00:26:57py.user修改type: behavior
2011-07-25 00:26:29py.user创建