wtfpython icon indicating copy to clipboard operation
wtfpython copied to clipboard

Can't really the chicken-egg problem be reproduced in pure Python?

Open ByteEater-pl opened this issue 3 years ago • 1 comments

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".

ByteEater-pl avatar Apr 05 '22 07:04 ByteEater-pl

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.

satwikkansal avatar Apr 21 '22 04:04 satwikkansal