I’m not 100% sure (and on my phone) but I think the idiomatic way would be to subclass https://docs.python.org/3/library/collections.abc.html#colle...
Incredible. This appears to be exactly the solution to my problem. Thanks! (And, if thunner happens to come across this: thanks, from a former TA of yours!)