On Fri, 21 Apr 2023 at 22:57, Jordan Macdonald <macdjord@gmail.com> wrote:
However, I then encountered an issue: I could define a Protocol that specified the 'stop()' method easily enough, but if I annotated the manager as taking that, it would accept any class which implemented a method named 'stop()', which was not correct; the manager should only accept threads which implement such a method.
To what extent is that actually a problem? Does it need any other features of the thread? My guess is that, after stopping the thread, it may want to join() it; in that case, what you could do is add join to the Protocol. Or whatever else is needed. You're trying to hybridize duck typing and inheritance typing, which seems odd. It should be possible to pick one or the other here. ChrisA