Newsgroups: comp.lang.python
From: David Stanek <dsta...@dstanek.com>
Date: Fri, 17 Jul 2009 08:08:48 -0400
Local: Fri, Jul 17 2009 8:08 am
Subject: Re: Override a method but inherit the docstring
On Fri, Jul 17, 2009 at 2:58 AM, Peter Otten<__pete...@web.de> wrote: This should never be the case. It violates LSP and would be very confusing to > Ben Finney wrote: >> Howdy all, >> The following is a common idiom:: >> class FooGonk(object): >> class BarGonk(FooGonk): >> The docstring for ‘FooGonk.frobnicate’ is, intentionally, perfectly >> Ideally there would be a way to specify that the docstring should be >> class BarGonk(FooGonk): >> but that violates DRY (the association between BarGonk and FooGonk is >> What is the most Pythonic, DRY-adherent, and preferably least-ugly > Just thinking aloud: Write a patch for pydoc that looks up the base-class > B.f.__doc__ will continue to return None, but > help(B.f) will show something like > No documentation available for B.f. > Help for A.f: > Of course that might be misleading when A.f and B.f are up to something readers of the code. -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||