[Python-Dev] Is implicit underscore assignment buggy?
tjreedy at udel.edu
Thu Jun 8 04:31:09 CEST 2006
"Guido van Rossum" <guido at python.org> wrote in message
news:ca471dc20606071625y55199a73r6ae369d5c8de4f52 at mail.gmail.com...
> This is by design.
> The intent is that as long as you call something that returns no
> value, your last result is not thrown away. IOW _ is the last result
> that wasn't None.
> Please don't change this.
What might be improved is the documentation of this, which I could not find
in a few minutes of searching. As of current 2.4 docs, the Tutorial,
Language, and Library manuals all have index pages for identifiers
beginning with '_' but none contain '_' itself. (And none have entries for
Language Reference 2.3.2 Reserved classes of identifiers lists all the
other special identifier classes starting with '_' but not '_' itself. I
think this would be a good place for an entry for '_' and its special
meaning in interactive mode.
Tutorial 2.1.2 Interactive Mode would be another place to mention the
special use of '_'.
If there is something I missed (that is not indexed), then I missed it.
Terry Jan Reedy
More information about the Python-Dev