If one executes the following statements: >>> class metatype(type):pass >>> class x(type,metaclass=metatype):pass >>> x.__class__ = x , one gets a type that is it's own type: (`type(x) is x`). However, `isinstance(x,x)` unexpectedly returns False. How is my `x` type not an instance of itself.
Works for me: >>> class meta(type): pass ... >>> class X(type, metaclass=meta): pass ... >>> X.__class__ = X >>> type(X) is X True >>> isinstance(X, X) True
This seems as though you might be using an older version of the interpreter (I tested in 3.4.3, 3.5.1 and 3.6.0a1+). Where did you get your interpreter? The official releases are on https://www.python.org/downloads/ - if you got it somewhere else, that might be something for whoever packaged your installer to fix.