En Thu, 21 Jan 2010 03:17:40 -0300, Michele Simionato
<michele.simion...@gmail.com> escribió:
On Jan 21, 12:09 am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar>
wrote:
This is basically the same technique as in
<http://permalink.gmane.org/gmane.comp.python.general/651001> but there
is a difference: you clone the function object *and* the code object it
is based on. As I understand it, code objects are immutable and there
is no need to clone them, but I may be wrong. Why did you feel the need
to clone the code object too?
No need. I just had the newfunc utility in my library (I think copied
from a recipe in the Python cookbook by Alex Martelli) so I used it.
In this case it is overkill, though. Also, I had no read your post
when I posted my solution, otherwise I would not have sent it ;)
Anyway, the setdocstring utility to extract the parent method was not
explicit in your post and may be of some use to somebody.
Ah, ok! I was afraid I missed something -- but reusing code is a perfectly
valid reason!
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list