Bruno Desthuilliers: > What is data is another type of sequence or iterable ?-)<
The original problem statement was: Florian Brucker: >Given a dictionary, I want to create a clustered version of it, collecting >keys that have the same value: [...] Another requirement is that it should >also work on lists, in that case with indices instead of keys. We may assume >that all values in the original dict/list can be used as dict keys.< If the problem changes, then the code has to/can change. When you write code it's better to avoid over-generalization (this is also a rule in Agile programming practices). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list