user4981459
user4981459

Reputation:

Need to understand meaning of two lambda on single line in python

I have below function in my code, I do not understand the meaning of it. Can anyone please guide me.

x = lambda a: lambda a: a + 10
print(x)
print(x(3))

Output:

<function <lambda> at 0x2adc7e51d1e0>
<function <lambda>.<locals>.<lambda> at 0x2adc7e654ea0>

Upvotes: 4

Views: 48

Answers (1)

Pac0
Pac0

Reputation: 23149

Basically, it's similar to this code function:

def myFunc(x):
   return lambda b: b + 10

x = lambda a: myFunc(a) 

note that the parameter on myFunc is not used, completely useless.

Upvotes: 1

Related Questions