Raymond Hettinger <[email protected]> writes: > Here's a handy utility function for you guys to play with: > http://code.activestate.com/recipes/577676/
Cute, but why not use collections.defaultdict for the return dict?
Untested:
d = defaultdict(list)
for key,value in ifilter(bool,imap(mapper, data)):
d[key].append(value)
...
--
http://mail.python.org/mailman/listinfo/python-list
