how to inherit docstrings?

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Jun 10 03:22:36 EDT 2011


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



More information about the Python-list mailing list