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


Groups > comp.lang.python > #7361

Re: how to inherit docstrings?

From Gregory Ewing <greg.ewing@canterbury.ac.nz>
Newsgroups comp.lang.python
Subject Re: how to inherit docstrings?
Date 2011-06-10 19:22 +1200
Message-ID <95dv1vFmgrU1@mid.individual.net> (permalink)
References <943d6cc1-5e1e-4f39-8003-6d70cbbed3a5@glegroupsg2000goo.googlegroups.com>

Show all headers | 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