[Python-ideas] inheriting docstrings
Jan Kaliszewski
zuo at chopin.edu.pl
Sat Jun 11 13:59:23 CEST 2011
Jan Kaliszewski dixit (2011-06-11, 13:02):
> +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)
> ...
Sorry,
s/ super(dict/ super(MyDict/
of course.
More information about the Python-ideas
mailing list