Skip to content
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

annotations: expand documentation on "simple" assignment targets #120535

Merged
merged 2 commits into from
Jun 15, 2024

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Jun 15, 2024

This behavior is rather surprising and it was not clearly specified.


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

This behavior is rather surprising and it was not clearly specified.
@JelleZijlstra JelleZijlstra added docs Documentation in the Doc dir skip issue skip news needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jun 15, 2024
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks, I agree that this can be usefully clarified.

Separately to improving the documentation, we could consider changing the implementation to use a bool for the simple field. I also wonder why annotations for complex targets are evaluated at all if these annotations are never stored in the __annotations__ dictionary -- but this problem will shortly be going away with PEP-649, so I suppose we don't really need to worry about it too much :-)

Doc/library/ast.rst Outdated Show resolved Hide resolved
Doc/reference/simple_stmts.rst Outdated Show resolved Hide resolved
@JelleZijlstra
Copy link
Member Author

we could consider changing the implementation to use a bool for the simple field.

I think that's hard because bool isn't a builtin type in ASDL.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

I think that's hard because bool isn't a builtin type in ASDL.

A shame, but oh well

@JelleZijlstra JelleZijlstra enabled auto-merge (squash) June 15, 2024 15:11
@JelleZijlstra JelleZijlstra merged commit 9e0b11e into python:main Jun 15, 2024
27 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 15, 2024
…honGH-120535)

This behavior is rather surprising and it was not clearly specified.

(cherry picked from commit 9e0b11e)

Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 15, 2024

GH-120555 is a backport of this pull request to the 3.13 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 15, 2024
…honGH-120535)

This behavior is rather surprising and it was not clearly specified.

(cherry picked from commit 9e0b11e)

Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 15, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jun 15, 2024

GH-120556 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Jun 15, 2024
@JelleZijlstra JelleZijlstra deleted the annassign-simple branch June 15, 2024 15:21
JelleZijlstra added a commit that referenced this pull request Jun 15, 2024
…ts (GH-120535) (#120556)



This behavior is rather surprising and it was not clearly specified.

(cherry picked from commit 9e0b11e)

Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
JelleZijlstra added a commit that referenced this pull request Jun 15, 2024
…ts (GH-120535) (#120555)



This behavior is rather surprising and it was not clearly specified.

(cherry picked from commit 9e0b11e)

Co-authored-by: Jelle Zijlstra <[email protected]>
Co-authored-by: Alex Waygood <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
…hon#120535)

This behavior is rather surprising and it was not clearly specified.

Co-authored-by: Alex Waygood <[email protected]>
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
…hon#120535)

This behavior is rather surprising and it was not clearly specified.

Co-authored-by: Alex Waygood <[email protected]>
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
…hon#120535)

This behavior is rather surprising and it was not clearly specified.

Co-authored-by: Alex Waygood <[email protected]>
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 issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants