classification
Title: Document special meanings of a single underscore
Type: enhancement Stage: resolved
Components: Documentation Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: SilentGhost, cripitone, docs@python
Priority: normal Keywords:

Created on 2020-04-05 09:50 by cripitone, last changed 2020-04-05 12:47 by cripitone. This issue is now closed.

Messages (3)
msg365814 - (view) Author: (cripitone) Date: 2020-04-05 09:50
The official documentation doesn't seem to cover the various meanings/uses of the single underscore "_", in different contexts (not just the interactive interpreter).

See for example:

https://www.datacamp.com/community/tutorials/role-underscore-python
msg365817 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2020-04-05 11:43
Various meanings are documented in appropriate sections, ignoring and use in loops is a misunderstanding on part of the author - using underscore there is convention and doesn't have special meaning on the language level.
msg365818 - (view) Author: (cripitone) Date: 2020-04-05 12:47
> Various meanings are documented in appropriate sections

Uhm, you're right, though some of them are not that easy to find using the searchbar in the doc website, for example the meaning of "_" in https://docs.python.org/3.7/tutorial/introduction.html

Maybe it would help adding "(a single underscore)" at the end of the sentence "In interactive mode, the last printed expression is assigned to the variable _". This way one would get it by searching for "single underscore" or even "underscore".
(and maybe it could also be mentioned in https://docs.python.org/3.7/tutorial/interpreter.html and/or https://docs.python.org/3.7/tutorial/appendix.html which deal specifically with the interactive interpreter)
History
Date User Action Args
2020-04-05 12:47:13cripitonesetmessages: + msg365818
2020-04-05 11:43:50SilentGhostsetstatus: open -> closed

nosy: + SilentGhost
messages: + msg365817

resolution: not a bug
stage: resolved
2020-04-05 09:50:14cripitonecreate