[Python] What is the Diamond Problem in Python and why its not appear in python2?

Discussão em 'Python' iniciado por Stack, Julho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I got this code:

    class A:
    pass

    class B(A):
    pass

    class C(A):
    pass

    class D(A,B):
    pass

    d = D()


    In Python3 i get a MRO Error. I mean it appears because the Diamond Problem. In Python2 its no Problem. Why is this the case, and what is this Diamond Problem exactly ?

    Continue reading...

Compartilhe esta Página