How to use 'python apply lambda to list' in Python

Every line of 'python apply lambda to list' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
7def _recursive_apply(f, l):
8 if isinstance(l, (list, tuple)):
9 out = [_recursive_apply(f, l_) for l_ in l]
10 if isinstance(l, tuple):
11 out = tuple(out)
12 return out
13 else:
14 return f(l)

Related snippets