gh-145300: Document bytearray.extend() behavior when mutating during …#145637
gh-145300: Document bytearray.extend() behavior when mutating during …#145637anand-official wants to merge 1 commit intopython:mainfrom
Conversation
…uring iteration Add a note to sequence.extend() documentation clarifying that bytearray behaves differently from list and array.array when extending a sequence with itself during iteration. bytearray captures the length at the start and can at most double the original length, while list and array.array pick up elements as they're added, potentially leading to unbounded growth.
picnixz
left a comment
There was a problem hiding this comment.
The DPO thread is still ongoing so I'm closing it for now.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
|
Thanks for the update. I’ll follow the discussion and be happy to update the documentation once the behavior is settled. |
…iteration
Add a note to sequence.extend() documentation clarifying that bytearray behaves differently from list and array.array when extending a sequence with itself during iteration. bytearray captures the length at the start and can at most double the original length, while list and array.array pick up elements as they're added, potentially leading to unbounded growth.
.extend()behavior in bytearray #145300📚 Documentation preview 📚: https://cpython-previews--145637.org.readthedocs.build/