-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
bpo-35224: Additional documentation for Assignment Expressions #15935
bpo-35224: Additional documentation for Assignment Expressions #15935
Conversation
Doc/faq/design.rst
Outdated
@@ -151,66 +151,10 @@ to tell Python which namespace to use. | |||
Why can't I use an assignment in an expression? | |||
----------------------------------------------- | |||
|
|||
Many people used to C or Perl complain that they want to use this C idiom: | |||
Starting in Python 3.8, you can! There is a new syntax, `:=`, that assigns a |
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.
@emilyemorehouse
Maybe with this sentence?
Starting in Python 3.8, you can use the walrus operator `:=` that assigns a variable in an expression::
while chunk := fp.read(200):
print(chunk)
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.
Thanks! I used your example and added something similar.
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.
Thank you
@emilyemorehouse: Status check is done, and it's a success ✅ . |
Thanks @emilyemorehouse for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
…nGH-15935) Add or update assignment expression documentation for: - FAQ - Design - Reference - Expressions - Reference - Lexical Analysis https://bugs.python.org/issue35224 Automerge-Triggered-By: @matrixise (cherry picked from commit 6357c95) Co-authored-by: Emily Morehouse <[email protected]>
GH-15967 is a backport of this pull request to the 3.8 branch. |
) (GH-15967) Add or update assignment expression documentation for: - FAQ - Design - Reference - Expressions - Reference - Lexical Analysis https://bugs.python.org/issue35224 Automerge-Triggered-By: @matrixise (cherry picked from commit 6357c95) Co-authored-by: Emily Morehouse <[email protected]>
…nGH-15935) Add or update assignment expression documentation for: - FAQ - Design - Reference - Expressions - Reference - Lexical Analysis https://bugs.python.org/issue35224 Automerge-Triggered-By: @matrixise
Add or update assignment expression documentation for:
https://bugs.python.org/issue35224
Automerge-Triggered-By: @matrixise