Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions Doc/tutorial/appendix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@ Typing an interrupt while a command is executing raises the
:exc:`KeyboardInterrupt` exception, which may be handled by a :keyword:`try`
statement.

.. _special-var:

Special ``_`` variable
-------------------------

There is a special variable ``_`` in interactive mode. It stores the result of the
last evaluation (*except* ``None``), stored in the :mod:`builtins` module.

For example:

>>> 1 + 2
3
>>> _
3
>>> print("1+2=3")
1+2=3
>>> _ # Doesn't store None returned by print()
3
>>> _+4
7

.. _tut-scripts:

Expand Down