Revision 1875
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/collection.py | ||
---|---|---|
1 |
# Data structures |
|
2 |
|
|
3 |
def rmap(func, value): |
|
4 |
'''Recursively applies func to all members of value''' |
|
5 |
if isinstance(value, list): return map(func, list_) |
|
6 |
elif isinstance(value, dict): |
|
7 |
return dict(((k, func(v)) for k, v in value.iteritems())) |
|
8 |
else: return func(value) |
Also available in: Unified diff
Added collection.py with rmap()