From 540733f6304928d745efcea0e880fc515c4a9201 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Wed, 17 Jan 2018 09:36:04 -0500 Subject: [PATCH] _ --- source/the-interpreter.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/the-interpreter.rst b/source/the-interpreter.rst index 924ce03..f5b8251 100644 --- a/source/the-interpreter.rst +++ b/source/the-interpreter.rst @@ -15,6 +15,19 @@ This is known as the Python interpreter, and is a REPL (Read–Eval–Print Loop Tricks ++++++ +``_`` Trick +/////////// + +The ``_`` variable can be used to reference the last thing that was eval'd (e.g. automatically printed to the screen). For example:: + + >>> 1 + 1 + >>> a = _ + >>> print(a) + 1 + +Very useful when using the interactive interpreter! + Bytecode Trick //////////////