I’ve started to like Scala REPL’s ability to reference previous computations with resX and wanted to know if there’s a way to access that in Python/bpython/iPython REPL.
I’ve started to like Scala REPL’s ability to reference previous computations with resX and
Share
The default python interpreter manipulates a variable by the name
_to have the last returned value (includingNonefor expressions that return it). iPython extends this to__and___as well asOut, which is a dict containing all of the returned results.This feature is present only in interactive interpreters, though. In a regular python module,
_is undefined (unless you define it).