I have a variable that contains a function.
def foo(x):
return x + 42
def bar(x):
return x - 42
my_var = foo
I want to check if that function is a certain function. Should I use is
or ==
?
my_var == foo
my_var == bar
and
my_var is foo
my_var is bar
both return what I expect.