In python, both classes and functions are callables, but in my case, I would only like to call something if it is a function.
Example Code:
class AClass:
pass
def a_func():
pass
type(AClass)
# Output:
<class 'type'>
type(a_func)
# Output:
<class 'function'>
So, my actual question is how do I write an if saying something like:
if type(something) == <a function type>:
# call the function
I have tried doing this:
if isinstance(AClass, type):
# passes through
if isinstance(a_func, type):
# passes through too
So, checking with type in isinstance, I cannot get it to work.
I am comparing with type and isinstance(), any other way to solve it would be appreciated too.