Mike McClain <mike.junk...@att.net> writes:

> Steven D'Aprano and Ben Finney used these '_' and '__'.
> Steve said, "[[] for _ in range(5)]".
> Ben said, "[ [] for __ in range(5) ]".
>
>     These aren't listed separately in the index

That's right, the names ‘_’ and ‘__’ have no special meaning in
Python-the-language so they don't appear in the index.

Steven and I both used those respective names to communicate “never
going to use this value but the syntax requires a name here”.

> where might I find written discussion of these?

I find Nick Coghlan's answer on StackOverflow
<URL:https://stackoverflow.com/questions/5893163/what-is-the-purpose-of-the-single-underscore-variable-in-python/5893946#5893946>
to be especially helpful.

Nick also explains that, because the name ‘_’ has too many conventional
meanings already, the name ‘__’ is better for “don't need this value but
I am required to specify a name”.

-- 
 \         “The double standard that exempts religious activities from |
  `\       almost all standards of accountability should be dismantled |
_o__)                   once and for all.” —Daniel Dennett, 2010-01-12 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to