root/lib/collection.py @ 1878
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) |