def curried_f(arg1):
return f(arg1, *args, **kwargs)
return curried_f
# Fix the path strings
p1, p2 @ expandvars, abspath, normcase, curry(relpath, start)
Storing the modifiers in a mutable like a list, one could do rather complex stuff:
def add(a, b):
return a + b
def sub(...; def mult(...; def div(... # ...the obvious way.
def permutations(L):
for _ in range(possible_permutations)
next_permutation = ...
yield next_permutation
L = [curry(add, 1), curry(sub, 2), curry(mult, 3), curry(div, 4)]
# Prints the result for all possible combinations of the four operations +1, -2, *3, /4
# applied to 1.
for permutation in permutations(L):
x = 1
x @ permutation
print(x)
I'm not sure where to go from here. Does this idea qualify for a PEP? Is it even possible to be implemented? Has it already been discussed? What do you think about it? Please share your opinions, suggestions and improvements!