[Python-ideas] Fwd: grouping / dict of lists

Chris Barker chris.barker at noaa.gov
Fri Jul 13 01:08:47 EDT 2018


On Mon, Jul 9, 2018 at 3:38 PM, David Mertz <mertz at gnosis.cx> wrote:

> In my mind, I *rarely* (which is more than never) have my data in the form
> of a sequence of key/value pairs.  The version of the API that assumes data
> starts that way feels like either a niche case, or demands preprocessing
> before it's ready to pass to grouping() or collections.Grouping().
>

sure, but it makes it easy to use a different approach -- i.e. a
comprehension with expressions rather than a key (and maybe value)
function. AT least two people have expressed a preference for that.

That said, an identity key is rarely interesting either.
>

is it EVER interesting?? wouldn't it be essentially a Counter, without the
counting? :-)



> So I think have key=None mean "assume we get key/val pairs is harmless to
> the more common case where we give an explicit key function.
>

I'm not sure we'll know what's more common 'till it's loose in the wild --
any problem can be solved either way -- which one will people prefer?

Given that there Is a preference for comprehensions over map() -- I think
it will see a lot of use.

-CHB


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180713/008e669c/attachment-0001.html>


More information about the Python-ideas mailing list