Quantcast
Channel: Currying in Python lambdas - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Currying in Python lambdas

0
0

I'm trying to write a naive curried function in Python 2.7, but it seems like the inner lambda doesn't have an access to the parent lambda scope.

For simplicity, let's take this function:

add = lambda a: lambda b: a + b

The inner lambda's scope can't access the outer one (Python can't recognize a).

Is there a convenient way to make the outer scope accessible?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images