classification
Title: Mechanism for inheriting docstrings and signatures
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, asvetlov, bignose, cvrebert, eric.snow, ncoghlan, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2012-08-20 04:37 by ncoghlan, last changed 2013-01-26 15:20 by serhiy.storchaka.

Messages (2)
msg168618 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2012-08-20 04:37
While working on #8810, I was reminded of the problem of wanting to inherit docstrings while replacing a method implementation.

The abstract base class method docstrings for tzinfo.utcoffset and tzinfo.dst are also correct for the concrete subclasses in the pure Python and the C versions. However, the docstrings currently need to be duplicated in all 3 places manually.

functools.wraps already plays in this space, but arguably asserts *too much* about the relationship between components

A couple of descriptors on bound and unbound methods (for __doc__ and __signature__) could have dealt with this fairly easily, but we don't have unbound methods any more :(
msg168619 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2012-08-20 04:40
Slight correction: turns out this docstring appears in a lot of other places, too.
History
Date User Action Args
2013-01-26 15:20:39serhiy.storchakasetnosy: + serhiy.storchaka
2012-08-26 20:13:06Arfreversetnosy: + Arfrever
2012-08-25 02:01:00cvrebertsetnosy: + cvrebert
2012-08-20 11:17:49ncoghlansetfiles: - issue8810_reconcile_docs.patch
2012-08-20 11:17:09ncoghlansetmessages: - msg168622
2012-08-20 11:17:04ncoghlansetmessages: - msg168621
2012-08-20 10:41:25asvetlovsetnosy: + asvetlov
2012-08-20 06:42:39bignosesetmessages: + msg168622
2012-08-20 06:25:34bignosesetfiles: + issue8810_reconcile_docs.patch

nosy: + bignose
messages: + msg168621

keywords: + patch
2012-08-20 04:40:40ncoghlansetmessages: + msg168619
2012-08-20 04:37:11ncoghlancreate