Why monkey patching on module object doesn't work ?

Shiyao Ma i at introo.me
Thu Aug 18 00:14:07 EDT 2016


Hi,

I am using Python2.

For the following snippet,

http://ideone.com/i36pKO

I'd suppose the dummy_func would be invoked, but seems not.

Indeed, heapq.heapify does invoke cmp_lt per here:
https://hg.python.org/cpython/file/2.7/Lib/heapq.py#l136

So why this way of monkey patching failed?



Regards.



More information about the Python-list mailing list