list comprehensions put non-names into namespaces!
tjreedy at udel.edu
Fri May 26 20:09:23 CEST 2006
"Mel Wilson" <mwilson-to at sympatico.ca> wrote in message
news:7hBdg.2071$ho5.166428 at news20.bellglobal.com...
> Point of information, would this be the interpreter putting
> the result of its last calculation in _ ?
Yes, in interactive mode (but not in batch mode) it binds the valid name
'_' to the result of statement expressions.
> >>> [2*x for x in range(5)]
> [0, 2, 4, 6, 8]
> >>> _
which here is the list.
Terry Jan Reedy
More information about the Python-list