from types import MethodType(方法),FunctionType(函數) def func(): pass print(isinstance(func,FunctionType)) # True class A(): def aaa(self): pass print(isinstance(aaa,FunctionType)) # True a=A() print(isinstance(a.aaa,MethodType)) # True要有實例化出來的對象才能夠,若是隻是用類名去調用的話仍是function,只有用實例化出來的對象去調用才能夠獲得method 咱們的函數只有跟咱們的實例化出來的對象有綁定關係才能稱之爲方法,不然都是函數,即使它是寫到類裏面的方法,沒有跟咱們的類實例化出來的對象進行綁定,它依然是函數,而不是類裏面的方法.