Is it possible monkey patch like this?

Terry Reedy tjreedy at
Tue Dec 18 17:49:07 CET 2012

On 12/18/2012 5:26 AM, Marc Aymerich wrote:

> I want to monkey patch a method that has lots of code so I want to
> avoid copying all the original method for changing just two lines.

You omitted the most important piece of information. Can you modify the 
original code (or get someone else to do so) or must you leave it as is? 
Chris and Peter gave you answers for the former case. If the latter, you 
must copy and modify for the change you specified.

Terry Jan Reedy

More information about the Python-list mailing list