Stay SOLID and DRY with coroutines and functions as methods in python
The DRY solution is some kind of subclassing as you already did.
I think a "SOLID" solution is very hard to achieve under your condition. Fact is, you have two functions wait_meep
, which have actually different signature and semantics. Namely, the first one blocks for the sleep interval, which can be arbitrary long. The second one OTOH is async, i.e. needs special calling semantics and runs concurrently.
A somewhat comparable case is the Queue
class from the standard library. There you have get
and get_nowait
methods which do the same, in different ways. Second example could be __iter__
and __aiter__
methods.
So I think the only "correct" solution would be renaming one of the methods. Which would have the side effect that you could write it all as one class, i.e. reduce number of moving parts.