def bind(lst, func):
return [y for x in lst for y in func(x)]
bind=lambda l,f:sum(map(f,l),[])
def bind(lst,func):
return reduce(lambda x, y: x+func(y), lst, [])
import itertools
def bind(lst, func):
return list(itertools.chain.from_iterable(map(func, lst)))
def bind(lst,func):
result = []
for x in lst:
result += func(x)
return result
def bind(lst,func):
return sum(map(func, lst), []);
def bind(lst,func):
return sum(map(func,lst),[])
from itertools import chain
def bind(lst, func):
return list(chain.from_iterable([func(x) for x in lst])) # sometimes you just have to love python
bind=lambda lst,func: reduce(lambda a,b:a+b, map(func,lst[:]), [])
bind = lambda l,f: [e for i in [f(x) for x in l] for e in i]
bind = lambda lst,func: [o for e in lst for o in func(e)]
景越Python基础训练营QQ群