-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
gh-127833: lexical analysis: Improve section on Names #131474
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
base: main
Are you sure you want to change the base?
Conversation
16.0.0 can be found at | ||
https://www.unicode.org/Public/16.0.0/ucd/DerivedCoreProperties.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the link could be moved below too? Inline links are nice ;-)
include the uppercase and lowercase letters (``A`` through ``Z`` and ``a`` to | ||
``z``), the underscore ``_`` and, except for the first character, the digits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
include the uppercase and lowercase letters (``A`` through ``Z`` and ``a`` to | |
``z``), the underscore ``_`` and, except for the first character, the digits | |
include the uppercase and lowercase letters, the underscore ``_`` and, except | |
for the first character, the digits |
Do we really need to explain this here too?
This is just below:
Besides
A-Z
,a-z
,_
and0-9
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd definitely keep it here; making it clear that “letters in the ASCII range” is A-Z
and a-z
.
Perhaps shorten it:
include the uppercase and lowercase letters (``A`` through ``Z`` and ``a`` to | |
``z``), the underscore ``_`` and, except for the first character, the digits | |
include the uppercase and lowercase letters (``A-Z`` and ``a-z``), | |
the underscore ``_`` and, except for the first character, the digits |
I'd be OK with deduplicating the later occurence, but something like “ASCII characters as listed above” is almost as long as repeating the lists. This isn't code, it can be a little WET.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be better :-)
in (`id_start` `xid_continue`*)"> | ||
xid_continue: <all characters in `id_continue` whose NFKC normalization is | ||
in (`id_continue`*)"> | ||
identifier: <`NAME`, except keywords> | ||
|
||
A non-normative HTML file listing all valid identifier characters for Unicode | ||
16.0.0 can be found at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16.0.0 can be found at | |
15.1.0 can be found at |
Unicode categories use the version of the Unicode Character Database as
included in the :mod:unicodedata
module.
According to the docs that is 15.1.0 at the moment, maybe we should link to that one instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh apologies
Co-authored-by: Stan Ulbrych <[email protected]>
Use consistent terminology: "names" are "identifiers", "keywords", and "soft keywords".
Start with the simple case (ASCII), then get more and more technical.
Define NAME in the formal lexical grammar.
Exclude keywords in the
identifier
definition.📚 Documentation preview 📚: https://cpython-previews--131474.org.readthedocs.build/