Skip to content

Join computed suboptimally with multiple inheritance #4373

Open
@gvanrossum

Description

@gvanrossum
class Base:
    def foo(self): pass

class Mix: pass

class A(Mix, Base): pass

class B(Mix, Base): pass

def foo() -> None:
    a = [A(), B()]
    reveal_type(a)  # Shows Mix
    a.foo()  # E: "Mix" has no attribute "foo"

Could we do something better here? Ideally the inferred type of a should be an anonymous subclass of Mix and Base.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrongtopic-inheritanceInheritance and incompatible overrides

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions