Single underscore in interactive mode

Lie Ryan lie.1296 at gmail.com
Wed Jun 25 14:57:23 EDT 2014


On 25/06/14 16:20, candide wrote:

> As explained by the docs, an assignment statement_evaluates_  the expression on the right hand side. So we can deduce that at the very beginning of the 2nd prompt, "the result of the last evaluation" is 43. Nevertheless, calling _ raises a NameError exception!

Only expression can be evaluated, statements are executed. The shell 
cannot see beyond the immediate statement.

The documentation for sys.displayhook() describes that None as a special 
case is neither printed nor stored in `__builtins__._`.




More information about the Python-list mailing list