[Python-ideas] inheriting docstrings

Jan Kaliszewski zuo at chopin.edu.pl
Sat Jun 11 13:02:02 CEST 2011


+1 from me for writable (not mutable of course) class __doc__

-1 from me for all that more or less implicit doc inheritance.

Adding some decorator(s) to functools would be much better IMHO, e.g.:

    class MyDict(dict):
    
        @functools.basedoc(dict)
        def __setitem__(self, key, value):
            super(dict, self).__setitem__(key, value)
            ...

or:

    @functools.superdocs  # for methods without docstrings
    class MyDict(dict):
    
        def __setitem__(self, key, value):
            super(dict, self).__setitem__(key, value)
            ...

Cheers.
*j




More information about the Python-ideas mailing list