"If it walks like a duck and quacks like a duck, it must be a duck" (もしもそれがアヒルのように歩き、アヒルのように鳴くのなら、それはアヒルである) # 実装が同じクラスA,Bを定義 >>> class A(object): def printType(self): print('type' + type(self)) >>> class B(object): def printType(self): print('hogehoge : ' + str(type(self))) # それぞれ実行してみる >>> a = A() >>> a.printType() type : <class '__main__.A'> >>> b = B() >>> b.printType() hogehoge : <class '__ma