Uglier than yours, but down to two lines: def recur_map(f, data): return [ not hasattr(x, "__iter__") and f(x) or recur_map(f, x) for x in data ]
-- http://mail.python.org/mailman/listinfo/python-list
Uglier than yours, but down to two lines: def recur_map(f, data): return [ not hasattr(x, "__iter__") and f(x) or recur_map(f, x) for x in data ]
-- http://mail.python.org/mailman/listinfo/python-list