monkey patching __code__

Matt Wheeler m at funkyhat.org
Mon Mar 21 16:42:36 EDT 2016


On 20 March 2016 at 16:46, Sven R. Kunze <srkunze at mail.de> wrote:
> On 19.03.2016 00:58, Matt Wheeler wrote:
>>
>> I know you have a working solution now with updating the code &
>> defaults of the function, but what about just injecting your function
>> into the modules that had already imported it after the
>> monkeypatching?
>>
>> Seems perhaps cleaner, unless you'd end up having to do it to lots of
>> modules...
>
> Why do you consider it cleaner?

I think it would be more explicit and understandable for someone
reading your code.

I suppose it's quite subjective :)

-- 
Matt Wheeler
http://funkyh.at



More information about the Python-list mailing list