[issue42948] bytearray.copy is undocumented
New submission from wim glenn <wim.glenn@gmail.com>: bytearray type has a copy method which seems to be undocumented https://docs.python.org/3/library/stdtypes.html#bytes-and-bytearray-operatio... ---------- assignee: docs@python components: Documentation messages: 385164 nosy: docs@python, wim.glenn priority: normal severity: normal status: open title: bytearray.copy is undocumented type: enhancement versions: Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Patrick Haller <patrickhaller40@googlemail.com> added the comment: You will see this on every bytes and bytearray type as the behaviour described is the same for both. ---------- nosy: +HallerPatrick _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Change by Terry J. Reedy <tjreedy@udel.edu>: ---------- keywords: +patch nosy: +terry.reedy nosy_count: 3.0 -> 4.0 pull_requests: +23129 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24308 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Terry J. Reedy <tjreedy@udel.edu> added the comment: Patrick, I am not sure what you are saying. All the methods listed is this section are for both, as with bytes.count(sub[, start[, end]]) bytearray.count(sub[, start[, end]])ΒΆ but only bytearray has .copy (since there is never a need to copy an immutable). This appears to be only methods like this. PR created. ---------- stage: patch review -> type: enhancement -> behavior versions: -Python 3.6, Python 3.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Patrick Haller <patrickhaller40@googlemail.com> added the comment: Terry, I am sorry. You are of course right. I was somehow looking at count not copy. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Josh Rosenberg <shadowranger+python@gmail.com> added the comment: Does this need specific documentation? bytearray itself is documented with:
As bytearray objects are mutable, they support the mutable sequence operations in addition to the common bytes and bytearray operations described in Bytes and Bytearray Operations.
where "mutable" is a link to all the mutable sequence operations ( https://docs.python.org/3/library/stdtypes.html#typesseq-mutable ), including copy. Specifically documenting copy for bytearray is pointless; are we going to add specific documentation for append and remove and all the other mutable sequence operations as well? ---------- nosy: +josh.r _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Terry J. Reedy <tjreedy@udel.edu> added the comment: Josh, you are right. I closed the PR. Before closing, I will think about whether to propose a change to make this more prominent. I notice the issubclass(array.array, collections.abc.MutableSequence ) is True even though some of the methods (like clear, copy) are missing. ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
wim glenn <wim.glenn@gmail.com> added the comment: Oh, I've missed that part. Although the note (5) seems to indicate that the copy method refers to sequence types which don't support slicing, it still seems adequately documented under the mutable sequence operations. I'll close this. ---------- stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
Change by Terry J. Reedy <tjreedy@udel.edu>: ---------- resolution: -> not a bug _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue42948> _______________________________________
participants (4)
-
Josh Rosenberg -
Patrick Haller -
Terry J. Reedy -
wim glenn