Project

General

Profile

« Previous | Next » 

Revision 1875

Added collection.py with rmap()

View differences:

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