Two variable dictionary comprehension

Gregory Ewing greg.ewing at canterbury.ac.nz
Mon Apr 3 02:35:18 EDT 2017


Deborah Swanson wrote:

> Oh, come on. That's a fairly obscure citation in the docs, one that
> would take a good deal of experience and time reading through them to
> know was there,

You seemed to know that there was something called a "dict
comprehension". Googling for "python 3 dict comprehension"
gives me a link to an example of one in the docs as the
second result.

The first result is a page in Dive Into Python containing
a section on dict comprehensions.

Part of being a good programmer is knowing how to track
down the information you need!

Having said that, the index of the Python docs could be
improved a bit in this area -- currently it only mentions
"list" under "comprehension" (although the page it leads
to discusses the other types as well).

-- 
Greg


More information about the Python-list mailing list