Two variable dictionary comprehension

Deborah Swanson python at
Mon Apr 3 17:50:56 EDT 2017

Jerry Hill wrote, on April 03, 2017 1:48 PM
> On Mon, Apr 3, 2017 at 10:30 AM, Deborah Swanson 
> <python at> wrote:
> > Regular updates as the docs are updated would be a good 
> idea too. It's 
> > obvious that today's Google isn't up to it, although it 
> occurs to me 
> > that I haven't tried Google's site search on
> So, when you search google for the phrase "dict 
> comprehension" or "dictionary comprehension", nothing useful 
> comes up for you?  When I search either of those phrases, I 
> get lots of useful results, all of which spell out how to do 
> what you were originally asking about.  I know Google search 
> results are skewed by past usage, but I'm surprised that you 
> didn't find anything useful in the first couple of search results.
> When I do a search for 'dict comprehension' I get a boxed 
> result linking to PEP 274 as the first hit, then two Stack 
> Overflow questions, both of which demonstrate how to do 
> dictionary comprehensions.  Following that is another link to 
> PEP 274, a link to the Python docs on data structures (which 
> does talk about dict comprehensions, but it's way down on the 
> page), and then links to a bunch of tutorials.  If you had to 
> judge based on my search results, Google does a fine job of 
> answering python questions, at least when you already know 
> the key phrase to look for.
> -- 
> Jerry

Ah, but did you actually try to use the proposed solutions on the two
stackoverflow pages? It's been several weeks now, but I did, and neither
of those two examples fit my situation, which is why I ended up writing
my own, and unsatisfactorily at that.

I'm sorry you think the current edition of Google does such a fine job.
Has it really been that many years ago that the results Google returned
from a  properly formatted boolean search were really useful? I'd
imagine that the old Google would have returned a good 10 pages or more
(probably a lot more) of urls containing the phrase "dict comprehension"
or "dictionary comprehension". in which you'd find a rich variety of
specific situations to glean through. (You wouldn't have needed to
include "python" in the search phrase, since no other programming
language that I know of, or other English usage for that matter, has
dict comprehensions.)

Nowadays Google just comes up with a mere handful of sorta appropriate
urls, and rarely do I find exactly what I'm looking for. And usually
there's nothing related to all your search terms after a page or two of
results. You used to be able to keep sifting through pages of results
after the bulk of urls fitting your criteria had passed, and still find
useful things to look at, sometimes at page 500 or even much, much
farther down the list. It really paid to comb through them all,
especially if you didn't find exactly what you wanted in the early

But giving users the choice among tens or hundreds of similar pages
(fewer if you specify 100 results per page) doesn't give Google as much
grist for the advertising mill to pump out at the users, hence the
present day useless mess.


More information about the Python-list mailing list