wtfpython
wtfpython copied to clipboard
Can't really the chicken-egg problem be reproduced in pure Python?
The explanation of "The chicken-egg problem" says:
The relationship between object and type can't be reproduced in pure python. To be more precise the following relationships can't be reproduced in pure Python,
class A is an instance of class B, and class B is an instance of class A. class A is an instance of itself.
But it seems that's easy with __instancecheck__ and __subclasscheck__. Or am I mistaken?
Additionally, one occurrence of "python" has a small "p".
But it seems that's easy with instancecheck and subclasscheck. Or am I mistaken?
Yeah, I think the wording of the explanation is a bit ambiguous. Yes, you can override these methods to whatever logic you want. But it is not possible to achieve the said behaviour with their default implementation.