Re: Inheriting methods but over-riding docstrings

2010-01-21 Thread Gabriel Genellina
En Thu, 21 Jan 2010 03:17:40 -0300, Michele Simionato escribió: On Jan 21, 12:09 am, "Gabriel Genellina" wrote: This is basically the same technique as in but there is a difference: you clone the function object *and* the code o

Re: Inheriting methods but over-riding docstrings

2010-01-20 Thread Michele Simionato
On Jan 21, 12:09 am, "Gabriel Genellina" wrote: > This is basically the same technique as in   > 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

Re: Inheriting methods but over-riding docstrings

2010-01-20 Thread Gabriel Genellina
En Tue, 19 Jan 2010 08:44:09 -0300, Michele Simionato escribió: On Jan 16, 6:55 pm, Steven D'Aprano wrote: I have a series of subclasses that inherit methods from a base class, but I'd like them to have their own individual docstrings. from types import FunctionType, CodeType def newfu

Re: Inheriting methods but over-riding docstrings

2010-01-19 Thread Michele Simionato
On Jan 16, 6:55 pm, Steven D'Aprano wrote: > I have a series of subclasses that inherit methods from a base class, but > I'd like them to have their own individual docstrings. The following is not tested more than you see and will not work for builtin methods, but it should work in the common cas

Re: Inheriting methods but over-riding docstrings

2010-01-18 Thread Gabriel Genellina
En Sun, 17 Jan 2010 23:23:45 -0300, Steve Holden escribió: Gabriel Genellina wrote: Methods don't have docstrings; functions do. So one has to "clone" the function to set a new docstring. On behalf of all methods I would like to say "We demand the right to docstrings". print abs.__doc__

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread Steven D'Aprano
On Mon, 18 Jan 2010 01:45:17 +0100, Alf P. Steinbach wrote: > Steven: on a personal note, earlier when I saw you (I think it was you) > using the "Norwegian Parrot" example I thought it referred to me because > that was the only sense I could make of it, it followed right after some > discussion w

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread Stephen Hansen
On Sun, Jan 17, 2010 at 4:45 PM, Alf P. Steinbach wrote: > Steven: on a personal note, earlier when I saw you (I think it was you) > using the "Norwegian Parrot" example I thought it referred to me because > that was the only sense I could make of it, it followed right after some > discussion we

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread J
On Sun, Jan 17, 2010 at 19:45, Alf P. Steinbach wrote: > Steven: on a personal note, earlier when I saw you (I think it was you) > using the "Norwegian Parrot" example I thought it referred to me because > that was the only sense I could make of it, it followed right after some > discussion we had

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread Steve Holden
Gabriel Genellina wrote: > En Sat, 16 Jan 2010 14:55:11 -0300, Steven D'Aprano > escribió: > >> I have a series of subclasses that inherit methods from a base class, but >> I'd like them to have their own individual docstrings. The obvious >> solution (other than copy-and-paste) is this: >> >> >>

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread Alf P. Steinbach
* Gabriel Genellina: En Sat, 16 Jan 2010 14:55:11 -0300, Steven D'Aprano escribió: I have a series of subclasses that inherit methods from a base class, but I'd like them to have their own individual docstrings. The obvious solution (other than copy-and-paste) is this: class Base(object):

Re: Inheriting methods but over-riding docstrings

2010-01-17 Thread Gabriel Genellina
En Sat, 16 Jan 2010 14:55:11 -0300, Steven D'Aprano escribió: I have a series of subclasses that inherit methods from a base class, but I'd like them to have their own individual docstrings. The obvious solution (other than copy-and-paste) is this: class Base(object): colour = "Blue"

Re: Inheriting methods but over-riding docstrings

2010-01-16 Thread Gerard Flanagan
Steven D'Aprano wrote: I have a series of subclasses that inherit methods from a base class, but I'd like them to have their own individual docstrings. The obvious solution (other than copy-and-paste) is this: class Base(object): colour = "Blue" def parrot(self): """docstring