I've installed a third party library tornado by pip and need to override a method, say to_unicode
defined in the global scope of a module say tornado.escape
. So that all calls to that method will use my overridden version. Or maybe, I would want to control it so that only my code will use the overridden version.
If it had been defined inside a class, I'd have no problem to subclass it and override the method! But since this is just a method, I'm wondering how to override it.
Surprisingly, I found not suitable solution in SO, is this kind of impossible to achieve?