Skip to content

Conversation

@wyz23x2
Copy link
Contributor

@wyz23x2 wyz23x2 commented Jul 28, 2020

This patch states the special variable _ in interactive mode and also includes an example.

https://bugs.python.org/issue41394

wyz23x2 added 2 commits July 28, 2020 10:45
Made the statement more clear.
Added example stating _ is not defined at the start.
@wyz23x2
Copy link
Contributor Author

wyz23x2 commented Jul 28, 2020

Made changes.

@wyz23x2
Copy link
Contributor Author

wyz23x2 commented Jul 28, 2020

Added NEWS entry. Please check.

@bedevere-bot
Copy link

Thanks for making the requested changes!

: please review the changes made to this pull request.

@wyz23x2 wyz23x2 requested a review from ericvsmith July 28, 2020 03:39
Special ``_`` variable
-------------------------

There is a special variable ``_`` in interactive mode, stored in the :mod:`builtins`
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

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.

Copy link
Contributor Author

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).
Copy link
Member

@ericvsmith ericvsmith Jul 28, 2020

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."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree.

Copy link
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

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

See comments.

@wyz23x2
Copy link
Contributor Author

wyz23x2 commented Jul 28, 2020

Somehow the commits aren't updated here. /(ㄒoㄒ)/~~ Closing this, and submitting a new PR.

@wyz23x2 wyz23x2 closed this Jul 28, 2020
@wyz23x2
Copy link
Contributor Author

wyz23x2 commented Jul 28, 2020

See PR #21654 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting change review docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants