Is there a possibility to check if two python functions are interchangeable? For instance, if I have
def foo(a, b):
pass
def bar(x, y):
pass
def baz(x,y,z):
pass
I would like a function is_compatible(a,b) that returns True when passed foo and bar, but False when passed bar and baz, so I can check if they’re interchangeable before actually calling either of them.
Take a look at
inspect.getargspec():