lambdas in list comprehensions code example
Example 1: list comprehenstsion using lambda funcion
[(lambda x: x*x)(x) for x in range(10)]
Example 2: Creating lambda expressions in comprehension list
lambdas_list = [ (lambda a: lambda: a.some_var)(o) for o in obj_list ]
Example 3: Creating lambda expressions in comprehension list
lambdas_list = [ lambda i=o: i.some_var for o in obj_list ]