Simple map/reduce utility function for data analysis

Paul Rubin at nospam.invalid
Tue Apr 26 04:42:17 CEST 2011

Raymond Hettinger <python at> writes:
> Here's a handy utility function for you guys to play with:

Cute, but why not use collections.defaultdict for the return dict?

   d = defaultdict(list)
   for key,value in ifilter(bool,imap(mapper, data)):

More information about the Python-list mailing list