[Python-ideas] Allow a group by operation for dict comprehension

Steven D'Aprano steve at pearwood.info
Thu Jun 28 20:01:39 EDT 2018


On Thu, Jun 28, 2018 at 11:23:49AM -0700, Michael Selik wrote:

> The fact that you didn't use ``setdefault`` here, opting for repeatedly
> constructing new lists via concatenation, demonstrates the need for a
> built-in or standard library tool that is easier to use.

That would be setdefault :-)

What it indicates to me is the need for people to learn to use 
setdefault, rather than new syntax :-)


-- 
Steve


More information about the Python-ideas mailing list