On Jul 26, 6:55 pm, a...@pythoncraft.com (Aahz) wrote:
>
> Nice! Maybe stick this on the Cookbook?
http://code.activestate.com/recipes/576862/
Thanks for the suggestion,
Shai.
--
http://mail.python.org/mailman/listinfo/python-list
Shai wrote:
On Jul 27, 5:05 pm, Jean-Michel Pichavant
wrote:
Ben Finney wrote:
The docstring for ‘FooGonk.frobnicate’ is, intentionally, perfectly
applicable to the ‘BarGonk.frobnicate’ method also. Yet in overriding
the method, the original docstring is not associated with it.
On Jul 27, 5:05 pm, Jean-Michel Pichavant
wrote:
> Ben Finney wrote:
> >
> > The docstring for ‘FooGonk.frobnicate’ is, intentionally, perfectly
> > applicable to the ‘BarGonk.frobnicate’ method also. Yet in overriding
> > the method, the original docstring is not associated with it.
>
> I've also
Ben Finney wrote:
Howdy all,
The following is a common idiom::
class FooGonk(object):
def frobnicate(self):
""" Frobnicate this gonk. """
basic_implementation(self.wobble)
class BarGonk(FooGonk):
def frobnicate(self):
special_implemen
In article <056f629b-aa63-458a-ae16-ac40a759e...@h11g2000yqb.googlegroups.com>,
Shai wrote:
>
>class DocInherit(object):
>"""
>Docstring inheriting method descriptor
>
>The class itself is also used as a decorator
>"""
Nice! Maybe stick this on the Cookbook?
--
Aahz (a...@pytho
On Jul 17, 10:52 am, Steven D'Aprano wrote:
>
> When the decorator is called, the function object is just a function
> object, not a method, so there is no concept of "what class it is
> destined for".
>
... which points to the better solution: use a descriptor. With the
doc_inherit decorator def
On Fri, Jul 17, 2009 at 3:52 AM, Steven
D'Aprano wrote:
> On Fri, 17 Jul 2009 12:58:48 +1000, Ben Finney wrote:
>
>>> Using a decorator in this manner requires repeating the super class
>>> name. Perhaps there is a way to get the bases of BarGonk, but I don't
>>> think so, because at the time that
On Fri, Jul 17, 2009 at 2:58 AM, Peter Otten<__pete...@web.de> wrote:
> Ben Finney wrote:
>
>> Howdy all,
>>
>> The following is a common idiom::
>>
>> class FooGonk(object):
>> def frobnicate(self):
>> """ Frobnicate this gonk. """
>> basic_implementation(self.w
Peter Otten <__pete...@web.de> writes:
> Just thinking aloud: Write a patch for pydoc that looks up the
> base-class documentation.
That doesn't scale; I want the docstring to be discovered by the normal
interface (the ‘__doc__’ attribute) by *every* tool that gathers
docstrings from methods.
Al
On Fri, 17 Jul 2009 12:58:48 +1000, Ben Finney wrote:
>> Using a decorator in this manner requires repeating the super class
>> name. Perhaps there is a way to get the bases of BarGonk, but I don't
>> think so, because at the time that the decorator is called, BarGonk is
>> not yet fully defined.
Ben Finney wrote:
> Howdy all,
>
> The following is a common idiom::
>
> class FooGonk(object):
> def frobnicate(self):
> """ Frobnicate this gonk. """
> basic_implementation(self.wobble)
>
> class BarGonk(FooGonk):
> def frobnicate(self):
>
Paul McGuire writes:
> Two ideas come to mind, the decorator way and the metaclass way. I am
> not a guru at either, but these two examples work:
I think the decorator idea is most attractive to me, since it can be
applied per method.
> # the decorator way
> def inherit_docstring_from(cls):
>
On Jul 16, 8:01 pm, Ben Finney wrote:
> Howdy all,
>
> The following is a common idiom::
>
> class FooGonk(object):
> def frobnicate(self):
> """ Frobnicate this gonk. """
> basic_implementation(self.wobble)
>
> class BarGonk(FooGonk):
> def frobnica
On Fri, 17 Jul 2009 02:01:49 +0100, Ben Finney
wrote:
Howdy all,
The following is a common idiom::
class FooGonk(object):
def frobnicate(self):
""" Frobnicate this gonk. """
basic_implementation(self.wobble)
class BarGonk(FooGonk):
def frobni
On Thu, Jul 16, 2009 at 9:13 PM, Jean-Paul Calderone wrote:
> On Fri, 17 Jul 2009 11:01:49 +1000, Ben Finney
> wrote:
>>
>> Howdy all,
>>
>> The following is a common idiom::
>>
>> class FooGonk(object):
>> def frobnicate(self):
>> """ Frobnicate this gonk. """
>> basic
On Fri, 17 Jul 2009 11:01:49 +1000, Ben Finney
wrote:
Howdy all,
The following is a common idiom::
class FooGonk(object):
def frobnicate(self):
""" Frobnicate this gonk. """
basic_implementation(self.wobble)
class BarGonk(FooGonk):
def frobnicate(sel
16 matches
Mail list logo