Define variable used by lambda function outside : Lambda : Function PYTHON TUTORIALS


PYTHON TUTORIALS » Function » Lambda »

 

Define variable used by lambda function outside


def weird():
    tmp = (lambda: spam * 2)        
    spam = 42                       
    return tmp

act = weird()
print act()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Function
» Lambda