Skip to main content
🔒 Preview mode. The first 15 Foundations lessons are free; this one is Pro. Start a 7-day trial to unlock the editor, AI hints and the rest of the curriculum. Card required, cancel any time in Dashboard.Start 7-day trial →
← CoursesSenior Deep-DivesModule 6 · FAANG-2026 deep divesC3 linearisation — predict the MROpredict107 / 161
+150 XP
Task
📝 **Task:** Predict the exact output. Diamond inheritance: \`D(B, C)\` and \`E(C, B)\` — same four classes, opposite order in the bases. Each gets a different MRO. Then the test tries \`F(D, E)\` — which would require BOTH "B before C" (from D's MRO) AND "C before B" (from E's). What happens? 📋 Implement the function above. Tests run automatically. 💡 **Hint:** Re-read the theory if you get stuck.
Predict the output

Read the code carefully

class A:
    pass


class B(A):
    pass


class C(A):
    pass


class D(B, C):
    pass


class E(C, B):
    pass


print([cls.__name__ for cls in D.__mro__])
print([cls.__name__ for cls in E.__mro__])

try:
    class F(D, E):
        pass
except TypeError:
    print("F:mro_conflict")

What will the program print? Write here:

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…