gh-149267: Document ast.Constant.kind attribute#149268
Merged
JelleZijlstra merged 2 commits intopython:mainfrom May 2, 2026
Merged
gh-149267: Document ast.Constant.kind attribute#149268JelleZijlstra merged 2 commits intopython:mainfrom
JelleZijlstra merged 2 commits intopython:mainfrom
Conversation
The kind attribute of ast.Constant was not mentioned in the documentation. It is set to 'u' for u-prefixed string literals and None for all other constants.
Documentation build overview
|
| and the constants :data:`None` and :data:`Ellipsis`. | ||
|
|
||
| The ``kind`` attribute is an optional string. For string literals with a | ||
| ``u`` prefix (e.g. ``u'hello'``), ``kind`` is set to ``'u'``. For all other |
Member
There was a problem hiding this comment.
Suggested change
| ``u`` prefix (e.g. ``u'hello'``), ``kind`` is set to ``'u'``. For all other | |
| ``u`` prefix, ``kind`` is set to ``'u'``. For all other |
Per the style guide, please don't use latin abbreviations. Furthermore, I don't think the example is necessary here.
|
Thanks @anujbharambe for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
|
GH-149293 is a backport of this pull request to the 3.14 branch. |
|
GH-149294 is a backport of this pull request to the 3.13 branch. |
JelleZijlstra
pushed a commit
that referenced
this pull request
May 2, 2026
…149294) gh-149267: Document ast.Constant.kind attribute (GH-149268) The kind attribute of ast.Constant was not mentioned in the documentation. It is set to 'u' for u-prefixed string literals and None for all other constants. --------- (cherry picked from commit 3a1df78) Co-authored-by: Anuj Nitin Bharambe <119653366+anujbharambe@users.noreply.github.com> Co-authored-by: Anuj Bharambe <anujnitinb@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kindto theConstantclass signature inDoc/library/ast.rstkindis'u'foru-prefixed string literals andNonefor all other constantskind='u'outputFixes #149267
CC- @JelleZijlstra