Inheriting methods but over-riding docstrings
michele.simionato at gmail.com
Thu Jan 21 07:17:40 CET 2010
On Jan 21, 12:09 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
> 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.
More information about the Python-list