Re: [Tutor] monkey patching question

2015-02-18 Thread Albert-Jan Roskam
- Original Message - From: Dave Angel da...@davea.name To: tutor@python.org Cc: Sent: Tuesday, February 17, 2015 11:50 PM Subject: Re: [Tutor] monkey patching question On 02/17/2015 04:53 PM, Albert-Jan Roskam wrote: Hi, I would like to monkey patch a function 'decode

Re: [Tutor] monkey patching question

2015-02-17 Thread Dave Angel
On 02/17/2015 04:53 PM, Albert-Jan Roskam wrote: Hi, I would like to monkey patch a function 'decode' that is defined inside a class. It is defined there because it is a logical place, next to its counterpart *method* 'encode'. I can successfully monkey patch meth1, but when I call meth2, it

Re: [Tutor] monkey patching question

2015-02-17 Thread Danny Yoo
Apologies, but the answer might be unsatisfactory. The syntactic use of decorators is confusing the situation. Let's simplify. Your question is equivalent to the following scenario: def logged(g): def wrapped(x): print call return g(x)

[Tutor] monkey patching question

2015-02-17 Thread Albert-Jan Roskam
Hi, I would like to monkey patch a function 'decode' that is defined inside a class. It is defined there because it is a logical place, next to its counterpart *method* 'encode'. I can successfully monkey patch meth1, but when I call meth2, it does not use the patched decorator. How can this