Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #7360

Re: how to inherit docstrings?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: how to inherit docstrings?
Date Fri, 10 Jun 2011 19:16:15 +1200
Lines 21
Message-ID <95dum2FjuvU1@mid.individual.net> (permalink)
References <b5497fa4-b79b-454e-b2e1-9e48642e2d85@glegroupsg2000goo.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net ltXtTjMy90SQH9xKiSeGrQxe5iLsMbR0cqgs39FNqUw9oiULfD
Cancel-Lock sha1:/Koij7/CnKOSRaYcp1HP17jFUWM=
User-Agent Mozilla Thunderbird 1.0.5 (Macintosh/20050711)
X-Accept-Language en-us, en
In-Reply-To <b5497fa4-b79b-454e-b2e1-9e48642e2d85@glegroupsg2000goo.googlegroups.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7360

Show key headers only | View raw


Carl Banks wrote:

> Presumably, the reason you are overriding a method in a subclass
> is to change its behavior;

Not always true by any means, and maybe not even usually true.
Consider overriding for the purpose of implementing an abstract
method, or because something about the internal operation of a
method needs to be modified to suit the requirements of the subclass.

I have a lot of situations like this in PyGUI, where there is a
bunch of generic classes defining the public API, and subclasses
of them for each implementation (Cocoa, Gtk and Windows). There
are heaps and heaps of overridden methods in the implementation
classes, and very few of them need or should have a docstring
different from the generic one. Not automatically inheriting
the docstrings puts a big burden on the maintainer to keep all
of them in sync.

-- 
Greg

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: how to inherit docstrings? Carl Banks <pavlovevidence@gmail.com> - 2011-06-09 18:12 -0700
  Re: how to inherit docstrings? Ben Finney <ben+python@benfinney.id.au> - 2011-06-10 11:42 +1000
  Re: how to inherit docstrings? Eric Snow <ericsnowcurrently@gmail.com> - 2011-06-09 20:37 -0600
  Re: how to inherit docstrings? Terry Reedy <tjreedy@udel.edu> - 2011-06-09 23:59 -0400
    Re: how to inherit docstrings? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-10 09:48 +0000
  Re: how to inherit docstrings? Eric Snow <ericsnowcurrently@gmail.com> - 2011-06-09 22:41 -0600
  Re: how to inherit docstrings? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-10 19:16 +1200

csiph-web