def func(): return [lambda x:i*x for i in range(4)] print([j(2) for j in func()])
結果:[6,6,6,6]spa
def func(): return (lambda x:i*x for i in range(4)) print([j(2) for j in func()])
結果:[0,2,4,6]code