Possibilities for Python classes organized across files?

I’m used to the Java model where you can have one public class per file. Python doesn’t have this restriction, and I’m wondering what’s the best practice for organizing classes. Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So … Read more

Monkey patching a class in another module in Python

I’m working with a module written by someone else. I’d like to monkey patch the __init__ method of a class defined in the module. The examples I have found showing how to do this have all assumed I’d be calling the class myself (e.g. Monkey-patch Python class). However, this is not the case. In my case the class is initalised within a function in another module. See the (greatly simplified) example below: