Skip to content

gh-107427: Update the description of UNPACK_SEQUENCE#107429

Merged
corona10 merged 4 commits into
python:mainfrom
corona10:gh-107427
Jul 30, 2023
Merged

gh-107427: Update the description of UNPACK_SEQUENCE#107429
corona10 merged 4 commits into
python:mainfrom
corona10:gh-107427

Conversation

@corona10

@corona10 corona10 commented Jul 29, 2023

Copy link
Copy Markdown
Member

Comment thread Doc/library/dis.rst
right-to-left::

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

Copy link
Copy Markdown
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?

@corona10 corona10 Jul 29, 2023

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Comment thread Doc/library/dis.rst
right-to-left::

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@bedevere-bot

Copy link
Copy Markdown

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