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


Groups > comp.lang.python > #7361

Re: how to inherit docstrings?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!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:22:36 +1200
Lines 16
Message-ID <95dv1vFmgrU1@mid.individual.net> (permalink)
References <943d6cc1-5e1e-4f39-8003-6d70cbbed3a5@glegroupsg2000goo.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net TE/aBe8FxJDLep/0/QFsFAmVBEqAk6NJDZj5fESkAWpQrrr2JE
Cancel-Lock sha1:CqkJ5O/9nR9vEvZrd4KIX2Cc/C8=
User-Agent Mozilla Thunderbird 1.0.5 (Macintosh/20050711)
X-Accept-Language en-us, en
In-Reply-To <943d6cc1-5e1e-4f39-8003-6d70cbbed3a5@glegroupsg2000goo.googlegroups.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7361

Show key headers only | View raw


Carl Banks wrote:

> x = random.choice([Triange(),Square()])
> print x.draw.__doc__  # prints "Draws a shape"
> 
> Quick, what shape is x.draw() going to draw?

Your debugging code is insufficient. It should include

    print type(x)

and then it will be obvious what shape is going to get
drawn.

-- 
Greg

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


Thread

Re: how to inherit docstrings? Carl Banks <pavlovevidence@gmail.com> - 2011-06-09 20:36 -0700
  Re: how to inherit docstrings? Ben Finney <ben+python@benfinney.id.au> - 2011-06-10 15:18 +1000
    Re: how to inherit docstrings? Ben Finney <ben+python@benfinney.id.au> - 2011-06-10 15:25 +1000
      Re: how to inherit docstrings? Chris Angelico <rosuav@gmail.com> - 2011-06-10 15:39 +1000
  Re: how to inherit docstrings? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-10 19:22 +1200
  Re: how to inherit docstrings? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-10 09:51 +0000

csiph-web