Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-141984: Reword and reorganize Subscription (and Slicing) docs#141985

Merged
encukou merged 23 commits intopython:mainfrom
encukou:expressions-subscription
Feb 4, 2026
Merged

gh-141984: Reword and reorganize Subscription (and Slicing) docs#141985
encukou merged 23 commits intopython:mainfrom
encukou:expressions-subscription

Conversation

@encukou
Copy link
Member

@encukouencukou commentedNov 26, 2025
edited
Loading

This merges theSubscriptions andSlicings sections in the language reference. From the parser's point of view, slicing is a special case of subscription, and it makes sense to document it that way too.

The PR also touches Data model documentation: I've tried to move details of the runtime behaviour there, and to de-duplicate (and cross-link) as needed.
Similar for theslice attribute docs.

Todo:

  • Add a glossary entry forsubscript -- the term this uses consistently for the key/index/whatever in the square brackets.

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

encukouand others added7 commitsSeptember 10, 2025 17:59
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Blaise Pabon <blaise@gmail.com>
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Copy link
MemberAuthor

@encukouencukou left a comment

Choose a reason for hiding this comment

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

Thank you for going through this!

@encukouencukou marked this pull request as ready for reviewJanuary 7, 2026 15:19
Copy link
Member

@StanFromIrelandStanFromIreland left a comment

Choose a reason for hiding this comment

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

Just a few little things, overall looks very good!

subscription: `primary` '[' `subscript` ']'
subscript: `slice` | `tuple_slices`
tuple_slices: ','.(`slice` | `starred_expression`)+ [',']
slice: `proper_slice` | `assignment_expression`

Choose a reason for hiding this comment

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

By this grammar, if one doessomething[0],0 is anint and is aslice, but that contradicts with your glossary entry, that states it must be a "an object of typeslice"?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's a good point. I've considered the terms and the rules separate namespaces, but i agree it can be confusing.

StanFromIreland reacted with thumbs up emoji
Copy link
Member

@StanFromIrelandStanFromIreland left a comment

Choose a reason for hiding this comment

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

I read through most during your unicode shenanigans ;-), a few small things but otherwise LGTM.

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Copy link
Member

@StanFromIrelandStanFromIreland left a comment

Choose a reason for hiding this comment

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

With that, LGMT

@encukouencukouenabled auto-merge (squash)February 4, 2026 16:02
@encukouencukou added the needs backport to 3.14bugs and security fixes labelFeb 4, 2026
@encukouencukou merged commite423e0c intopython:mainFeb 4, 2026
31 checks passed
@github-project-automationgithub-project-automationbot moved this fromTodo toDone inDocs PRsFeb 4, 2026
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestFeb 4, 2026
pythonGH-141985)(cherry picked from commite423e0c)Co-authored-by: Petr Viktorin <encukou@gmail.com>Co-authored-by: Blaise Pabon <blaise@gmail.com>Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
@bedevere-app
Copy link

GH-144476 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelFeb 4, 2026
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@StanFromIrelandStanFromIrelandStanFromIreland approved these changes

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

@AA-TurnerAA-TurnerAwaiting requested review from AA-TurnerAA-Turner is a code owner

Assignees

No one assigned

Labels

docsDocumentation in the Doc dirskip news

Projects

Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@encukou@blaisep@StanFromIreland

[8]ページ先頭

©2009-2026 Movatter.jp