T
Travis Parks
I was a little disappointed the other day when I realized that
closures were read-only. I like to use closures quite a bit.
Can someone explain why this limitation exists? Secondly, since I can
cheat by wrapping the thing being closure-ified, how can I write a
simple wrapper that has all the same members as the thing (decorator),
that then applies them to the underlying thing?
I also like partial function application. What is the easiest way of
achieving this in Python? Would it look something like this:
def foo(x, y):
return x + y
xFoo = lambda y: foo(10, y)
closures were read-only. I like to use closures quite a bit.
Can someone explain why this limitation exists? Secondly, since I can
cheat by wrapping the thing being closure-ified, how can I write a
simple wrapper that has all the same members as the thing (decorator),
that then applies them to the underlying thing?
I also like partial function application. What is the easiest way of
achieving this in Python? Would it look something like this:
def foo(x, y):
return x + y
xFoo = lambda y: foo(10, y)