Mega Code Archive

 
Categories / Python Tutorial / Function
 

Lookup variable used in lambda

def weird():     spam = 42     handler = (lambda: spam * 2)         spam = 50     print handler()                      spam = 60     print handler()                       weird()