I've made a few failed attempts at this, but I think the key may be to mount the method after the class is initialized rather than to do it during class initialization, which is what I previously tried.
As best I can tell, mypy isn't going to let us do this. It doesn't like the dynamic setting of attributes. And the code quickly gets quite complicated and uninterpretable when you try it anyway.
I've made a few failed attempts at this, but I think the key may be to mount the method after the class is initialized rather than to do it during class initialization, which is what I previously tried.