06-19-2025, 11:21 PM
it defines a basic anonymous function (called a lambda function), useful for when you ever need to return a function like this:
############################################
def createAdder():
return lambda a1, a2 : a1 + a2 # a1 and a2 are the arguments
adder = createAdder() # returns the lambda function
print( adder(5,5) ) # --> 10
############################################
it does look a little similar to the c ternary but is completely different
############################################
def createAdder():
return lambda a1, a2 : a1 + a2 # a1 and a2 are the arguments
adder = createAdder() # returns the lambda function
print( adder(5,5) ) # --> 10
############################################
it does look a little similar to the c ternary but is completely different