2

なぜこの印刷はFalseなのですか?

#! /usr/bin/env python

class A(object):
    def __instancecheck__(self,arg):
        print self, type(self), arg , type(arg)

if __name__ == '__main__':
    a = A()
    print isinstance(a,a)

与えます:

$ ./isinstancecheck.py 
<__main__.A object at 0x7f0574198b90> <class '__main__.A'> <__main__.A object at     0x7f0574198b90> <class '__main__.A'>
False
4

2 に答える 2