-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
bpo-41394: State special _ in appendix of tutorial #21651
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
Conversation
Made the statement more clear. Added example stating _ is not defined at the start.
|
Made changes. |
|
Added NEWS entry. Please check. |
|
Thanks for making the requested changes! : please review the changes made to this pull request. |
| Special ``_`` variable | ||
| ------------------------- | ||
|
|
||
| There is a special variable ``_`` in interactive mode, stored in the :mod:`builtins` |
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.
Is it really true that _ is stored in builtins? I played around with it a while, and couldn't verify that. And even if it's true, is it important? I don't think so. Do you have another reference to _ being in builtins?
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.
This was stated in bpo-41394 too.
https://docs.python.org/3/reference/lexical_analysis.html#reserved-classes-of-identifiers
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.
Interesting. I still think it's unimportant for the tutorial and should be removed.
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.
OK. Working on it.
|
|
||
| There is a special variable ``_`` in interactive mode, stored in the :mod:`builtins` | ||
| module. It stores the result of the last evaluated expression (*except* ``None`` | ||
| — it remains unchanged). |
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 think this would read better as: "It stores the result of the last evaluated expression. If the last expression evaluated to None, then the value of _ is not updated."
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.
Agree.
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.
See comments.
|
Somehow the commits aren't updated here. /(ㄒoㄒ)/~~ Closing this, and submitting a new PR. |
|
See PR #21654 . |
This patch states the special variable
_in interactive mode and also includes an example.https://bugs.python.org/issue41394