Hacker News new | ask | show | jobs
by d0mine 451 days ago
Here’s 1% that gives 50% of result. Replace:

    class C:
        def __init__(self):
            self.foo = ConcreteFoo()

with:

   class C:
        def __init__(self, foo: SupportsFoo):
            self.foo = foo

where SupportsFoo is a Protocol. That’s it.