X Tutup
Skip to content

gh-145300: Document bytearray.extend() behavior when mutating during …#145637

Closed
anand-official wants to merge 1 commit intopython:mainfrom
anand-official:main
Closed

gh-145300: Document bytearray.extend() behavior when mutating during …#145637
anand-official wants to merge 1 commit intopython:mainfrom
anand-official:main

Conversation

@anand-official
Copy link

@anand-official anand-official commented Mar 8, 2026

…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.


📚 Documentation preview 📚: https://cpython-previews--145637.org.readthedocs.build/

…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.
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DPO thread is still ongoing so I'm closing it for now.

@bedevere-app
Copy link

bedevere-app bot commented Mar 8, 2026

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@anand-official
Copy link
Author

Thanks for the update. I’ll follow the discussion and be happy to update the documentation once the behavior is settled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changes docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup