Learning immediately: https://edu.csdn.net/course/play/26755/340162?utm_source=blogtoedu
1 is a function or method to determine how to call
Isinstance function can judge by calling a function or method.
Function type is FunctionType
The method is MethodType
class MyClass:
def process(self):
pass
def process():
pass
print(type(MyClass().process).__name__ == 'method')
print(type(process).__name__ == 'function')
from types import MethodType,FunctionType
print('MyClass.process:',isinstance(MyClass().process,FunctionType))
print('MyClass.process:',isinstance(MyClass().process,MethodType))
print('process:',isinstance(MyClass().process,FunctionType))
print('process:',isinstance(MyClass().process,MethodType))