monkey patching __code__

Sven R. Kunze srkunze at mail.de
Fri Mar 18 10:33:34 EDT 2016


On 18.03.2016 15:23, Ian Kelly wrote:
> On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>> Your patched version takes two extra arguments. Did you add the
>> defaults for those to the function's __defaults__ attribute?
> And as an afterthought, you'll likely need to replace the function's
> __globals__ with your own as well.

Thanks again. :-)

Again, why would it make sense for those dunder attributes to be part of 
the function but not of the code object?

Best,
Sven



More information about the Python-list mailing list