docstring reference to another docstring

Chris Rebert clp2 at rebertia.com
Mon Mar 9 18:30:06 EDT 2009


On Mon, Mar 9, 2009 at 3:23 PM, bdb112 <boyd.blackwell at gmail.com> wrote:
> A function of the class ClusterSet uses a similar function of the
> class Cluster to do most of its work.  Its docstring could have so
> much in common with that in Cluster that it could be just a line or
> two in addition to that of Cluster.
>
> Is there a way for the ClusterSet docstring to tack the Cluster
> docstring onto itself, rather than simply saying "See docstring for
> Cluster"?

#assume Cluster already defined by this point
class ClusterSet(object):
    __doc__ = Cluster.__doc__
    #rest of class body

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com



More information about the Python-list mailing list