News for hackers. Stuff that matters.
Re:Why if TYPE_CHECKING? by remram on Wednesday December 20, 2023 @07:01AM (#38707682)
> parent-child link between two classes is a cyclic dependency

What do you mean? Where is the cycle?

Re:Why if TYPE_CHECKING? by MereInterest on Wednesday December 20, 2023 @07:19AM (#38707814)
The parent holds a reference to the child. The child holds a reference to the parent.
Re:Why if TYPE_CHECKING? by remram on Wednesday December 20, 2023 @11:32AM (#38710447)
Why does the parent hold a reference to the child?

Are you talking about a specific pattern or implementation detail in the interpreter? Because I would not call this "dependency"...

Re:Why if TYPE_CHECKING? by diarrhea on Wednesday December 20, 2023 @07:16AM (#38707786)
I also wonder. If a child class knows its concrete parent (apart from where inheritance is declared), and not just references it via super(), things have already gone badly wrong.
Re:Why if TYPE_CHECKING? by coryrc on Wednesday December 20, 2023 @07:15AM (#38707785)

    class Parent:
      children : List[Child]

    class Child:
      __init__(self, parent: Parent):
Re:Why if TYPE_CHECKING? by remram on Wednesday December 20, 2023 @11:33AM (#38710473)
Ah yes, it might be what they mean. I assumed inheritance. Thanks.