Hello,
a common pattern to write curried functions (i.e. without the
need for a special partial application syntax, like in PEP 309)
is like in this example:
def functionLock (lk):
def transform (fn):
def lockedApply (*argl, **argd):
lk.acquire ()
try:
fn (*argl, **argd)
finally:
lk.release ()
return lockedApply
return transform
PEP 318 (decorators) contains some other examples.
I wonder if someone else than me would appreciate a syntax
like this:
def functionLock (lk) (fn) (*argl, **argd):
lk.acquire ()
try:
fn (*argl, **argd)
finally:
lk.release ()
It would even enable us to write curried function definitions
like this one:
def f (*a) (x=1, **b) (*c, **d):
[...]
Current approaches about currying or partial application
can't handle the latter in a simple/transparent way.
Will it be hard to implement the feature?
Are there any reasons that this syntax/concept is a bad idea?
Greetings,
Holger