Skip to content

Document when multiple inheritance is not allowed #136843

@JelleZijlstra

Description

@JelleZijlstra

Python generally supports multiple inheritance, but only under certain conditions (the classes must have compatible memory layouts, compatible metaclasses, and a compatible MRO). This behavior is quite stable in practice but the documentation doesn't discuss it very much:

I propose to add a section to the language reference (not the tutorial) about multiple inheritance, explaining how it works and when it doesn't.

Relatedly, I just posted a proposal to allow type checkers to better support this: https://discuss.python.org/t/solid-bases-for-detecting-incompatible-base-classes/99280

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions