Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-107427: Update the description of UNPACK_SEQUENCE #107429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 30, 2023

Conversation

corona10
Copy link
Member

@corona10 corona10 commented Jul 29, 2023

STACK.extend(STACK.pop()[:count:-1])
STACK.extend(STACK.pop()[:-count-1:-1])
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we also document somehow that we require STACK.pop() to have exactly count elements?

Copy link
Member Author

@corona10 corona10 Jul 29, 2023

Choose a reason for hiding this comment

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

Update the sentence Unpacks ``STACK[-1]`` into *count* individual values into Unpacks ``STACK.pop()`` into *count* individual values will be enough?

Copy link
Member

Choose a reason for hiding this comment

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

I don’t think so. Leave that sentence alone, but add e.g. “Require there to be exactly count values.”

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@corona10 corona10 requested a review from gvanrossum July 30, 2023 01:57
STACK.extend(STACK.pop()[:count:-1])
STACK.extend(STACK.pop()[:-count-1:-1])
Copy link
Member

Choose a reason for hiding this comment

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

I don’t think so. Leave that sentence alone, but add e.g. “Require there to be exactly count values.”

@corona10 corona10 requested a review from gvanrossum July 30, 2023 15:23
@gvanrossum
Copy link
Member

Technically the thing on top of the stack may not have a len(); it can be any iterable. The length check is done (unless it's a tuple or list) by continuing to iterate and expecting StopIteration.

@corona10 corona10 merged commit a24e25d into python:main Jul 30, 2023
@corona10 corona10 deleted the gh-107427 branch July 30, 2023 15:40
@corona10 corona10 added the needs backport to 3.12 only security fixes label Jul 30, 2023
@miss-islington
Copy link
Contributor

Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-107459 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 30, 2023
…107429)

(cherry picked from commit a24e25d)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
@bedevere-bot bedevere-bot removed the needs backport to 3.12 only security fixes label Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.