#monkey-patching

[ follow ]
Python
fromGrahamdumpleton
1 week ago

Detecting object wrappers - Graham Dumpleton

Monkey patching is risky but sometimes necessary for runtime instrumentation; strict caution and dependency/version management are essential when deploying tools like wrapt.
fromGrahamdumpleton
1 month ago

Status of wrapt (September 2025) - Graham Dumpleton

Back then, constructing decorators using function closures had various short comings and the resulting wrappers didn't preserve introspection and various other attributes associated with the wrapped function. Many of these issues have been resolved in updates to Python and the functools.wraps helper function, but wrapt based decorators were still useful for certain use cases such as being able to create a decorator where you could work out whether it was applied to a function, instance method, class method or even a class.
[ Load more ]