News for hackers. Stuff that matters.
Re:Show HN: Rust-Like Traits in Python by OJFord on Sunday November 21, 2021 @07:33PM (#29301289)
Why not use a decorator for that?

    @impl(Sheep, Animal)
    class ImplAnimalForSheep:
        ...
or something?

It probably needn't even be a separate class - just decorate the relevant methods (or the `Sheep` class itself) `@impl(Animal)` and check the necessary ones are implemented on instantiation.

There are no comments on this comment yet.