Function returns another function : Function as Return « Function « Python






Function returns another function

Function returns another function
def knights():
     title = 'Sir'
     action = (lambda x: title + ' ' + x)   
     return action                          

act = knights()
print act('robin')


           
       








Related examples in the same category

1.Return a lambda functionReturn a lambda function