Inheriting methods but over-riding docstrings

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jan 22 06:13:52 CET 2010


En Thu, 21 Jan 2010 03:17:40 -0300, Michele Simionato  
<michele.simionato at gmail.com> escribió:
> On Jan 21, 12:09 am, "Gabriel Genellina" <gagsl-... at 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




More information about the Python-list mailing list