+ 1

Confused about print function with lambda

So syntax is like this print((lambda x: x+2) (4)) How print functions "knows" that 4 should be used in lambda instead of x?

28th Jan 2017, 6:31 AM
Said
1 ответ
+ 2
because (lambda x: x+2)(4) is interpreted as a single argument. lambda is one of those few functions that require an argument outside of its parenthesis. I do agree that something like (lambda x(4): x+2) would've have been an easier way to synthax it
28th Jan 2017, 8:39 AM
ramzi
ramzi - avatar