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-135676: Simplify docs on lexing names#140464

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
encukou wants to merge5 commits intopython:main
base:main
Choose a base branch
Loading
fromencukou:lex-analysis-names-simpler

Conversation

@encukou
Copy link
Member

@encukouencukou commentedOct 22, 2025
edited by github-actionsbot
Loading

This simplifies the Lexical Analysis section on Names (but keeps it technically correct) by putting all the info about non-ASCII characters in a separate (and very technical) section.

It uses a mental model where the parser doesn't handle Unicode complexity “immediately”, but:

  1. parsesany non-ASCII character (outside strings/comments) as part of a name, since these can't (yet) be e.g. operators
  2. normalizes the name
  3. validates the name, using theid_start/id_continue sets (referred to in previous sections as “letter-like” and “number-like” characters, with a link to the details)

This also means we don't needxid_start/xid_continue to define the behaviour :)


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

encukouand others added4 commitsOctober 8, 2025 17:58
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>Co-authored-by: Blaise Pabon <blaise@gmail.com>Co-authored-by: Micha Albert <info@micha.zone>Co-authored-by: KeithTheEE <kmurrayis@gmail.com>
Copy link
Contributor

@willingcwillingc left a comment

Choose a reason for hiding this comment

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

Outstanding document@encukou. I had one small suggestion to be a bit more explicit on the normalization example with number.

This means that, for example, some typographic variants of characters are
converted to their "basic" form, for example::

>>> nᵘₘᵇₑʳ = 3
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be helpful to add an explicit comment that the normalized form ofnᵘₘᵇₑʳisnumber.

encukou reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Does this look good?

@encukou
Copy link
MemberAuthor

There was an insightful conversation in#140269. I'll update this PR to make things even clearer.

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

Reviewers

@willingcwillingcwillingc approved these changes

@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: Todo

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Docs: note requirement to normalise unicode identifiers passed to globals() and locals()

2 participants

@encukou@willingc

[8]ページ先頭

©2009-2025 Movatter.jp