Skip to content

invent a way to make abstract methods work with mro #721

Open
@KotlinIsland

Description

@KotlinIsland
from abc import abstractmethod


class Base:
    @property
    def t(self) -> int:
        return 1


class A:
    @property
    @abstractmethod
    def t(self) -> object: ...


class B(A, Base):  # won't work because it will call `t` in `A`
    pass


class B2(Base, A):
    pass

This code should be perfectly valid, but it's not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions