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
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):
On Jul 27, 5:05 pm, Jean-Michel Pichavant jeanmic...@sequans.com
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.
In article 056f629b-aa63-458a-ae16-ac40a759e...@h11g2000yqb.googlegroups.com,
Shai s...@platonix.com 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
On Jul 17, 10:52 am, Steven D'Aprano st...@remove-this-
cybersource.com.au 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.
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):
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.
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.
Also,
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.wobble)
class
On Fri, Jul 17, 2009 at 3:52 AM, Steven
D'Apranost...@remove-this-cybersource.com.au 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
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_implementation(self.warble)
The
On Fri, 17 Jul 2009 11:01:49 +1000, Ben Finney ben+pyt...@benfinney.id.au
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):
On Thu, Jul 16, 2009 at 9:13 PM, Jean-Paul Calderoneexar...@divmod.com wrote:
On Fri, 17 Jul 2009 11:01:49 +1000, Ben Finney ben+pyt...@benfinney.id.au
wrote:
Howdy all,
The following is a common idiom::
class FooGonk(object):
def frobnicate(self):
Frobnicate this
On Fri, 17 Jul 2009 02:01:49 +0100, Ben Finney
ben+pyt...@benfinney.id.au wrote:
Howdy all,
The following is a common idiom::
class FooGonk(object):
def frobnicate(self):
Frobnicate this gonk.
basic_implementation(self.wobble)
class
On Jul 16, 8:01 pm, Ben Finney ben+pyt...@benfinney.id.au 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):
Paul McGuire pt...@austin.rr.com 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
16 matches
Mail list logo