0

I know that I can define a function in a Python script and then pickle it. I also know that I can't pickle lambda expressions. Let's say that I defined a function functionA(x, y = 2) and now I would like to create another function (not by defining it using def keyword) functionB which is a functionA but with argument y = 3. I can write

functionB = lambda x: functionA(x, y = 3)

but in that case I can't pickle it. How can I pickle it but without defining a function:

def functionB(x, y = 3):
    return functionA(x, y = y)
Jason
  • 313
  • 2
  • 8

0 Answers0