1👍
✅
This is referred to as monkey patching. As you may have gathered from it’s less-than-flattering name, not always looked upon favorably. In the Python community, it’s not a common technique, generally reserved for when there’s no other option. Since you have a proper interface (subclassing) to achieve what you want, it’s best avoided.
Monkey patching can be fragile, breaking if the module you’re modifying changes underneath you. It can be hard for somebody else to modify/debug later because it’s not always obvious where the code actually lives.
That said, if it’s already there & working, you can keep it in. Nobody’s going to track you down and beat you in a dark alley for it.
Source:stackexchange.com