I installed the third-party tornado pip library and must override the method , say to_unicode, defined in the global scope of the module tornado.escape. So that all calls to this method use my overridden version. Or maybe I would like to control this so that only my code uses an overridden version.
If it were defined inside the class, I would have no problem subclassing it and overriding the method! But since this is just a method, I wonder how to redefine it.
Surprisingly, I did not find a suitable solution in SO, is this impossible to achieve?
source
share