Steven D'Aprano wrote: > The most important difference between my suggestion and that of the OP is > that he limited the key function to something which returns a truth > value, while I'm looking for something more general which can split the > input into an arbitrary number of collated sublists.
Generally along the lines of def scatter (seq, criterion): lists = {} for s in seq: lists.setdefault (criterion (s), []).append (s) return lists modulo a defaultdict or some such ? Mel. > > > -- http://mail.python.org/mailman/listinfo/python-list