Two variable dictionary comprehension

Terry Reedy tjreedy at udel.edu
Tue Apr 4 14:58:56 EDT 2017


On 4/3/2017 6:09 PM, Deborah Swanson wrote:
> Nathan Ernst wrote, on April 03, 2017 1:59 PM
>>
>> I was a bit surprised when I looked at the language reference
>> for 3.6.x. I expected there'd be a direct link to
>> comprehensions, but there's not.
...
>> FWIW, If one was completely new to Python, even knowing the
>> syntax is known as a "comprehension" might be unknown. I
>> certainly didn't know what a comprehension was when I was
>> learning Python. A coworker showed me, some 13 years ago.

> Thanks Nate, for your comprehension of the plight of many, if not most,
> newish Python coders. And it certainly doesn't help to ask the list to
> fill in some of the holes and be met with criticism for asking, but I
> digress. It is what it is.

I have more than once looked at the Reference TOC: Expressions
https://docs.python.org/3/reference/index.html
and wondered 'where are comprehensions?' (and a few other things).  I 
just opened Issue 29983: "Reference TOC: expand 'Atoms' and 
'Primaries'", https://bugs.python.org/issue29983, suggesting that

6.2. Atoms
6.3. Primaries

be expanded to

6.2. Atoms, including identifiers, literals, and comprehensions
6.3. Primaries: attributes, subscripts, slices, and calls

The 'primaries' list is complete.  The full 'atoms' list is too long so 
I picked what I thought might be the three most important and added 
'including' to indicate that this is a selection.

There might be opposition (or just +-0 indifference) from developers who 
are CS language theory wonks who have forgotten how obscure the terms 
'atom' and 'primary' are in this context.  So anyone supporting this 
should say so on the issue.

https://bugs.python.org/issue29981, adding index entries, should be 
routine, but at least one +1 would be helpful.

-- 
Terry Jan Reedy



More information about the Python-list mailing list