This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月20日 04:37 by ncoghlan, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg168618 - (view) | Author: Alyssa 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: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年08月20日 04:40 | |
Slight correction: turns out this docstring appears in a lot of other places, too. |
|||
| msg209706 - (view) | Author: Yury Selivanov (yselivanov) * (Python committer) | Date: 2014年01月30日 06:20 | |
Perhaps, something like @functools.inherit decorator could help: https://gist.github.com/1st1/8703533 (just a quick illustration). |
|||
| msg259796 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年02月07日 18:20 | |
After issue15582, is it still actual? |
|||
| msg259813 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2016年02月08日 04:28 | |
Agreed, making it easy to follow the inheritance chains at docstring lookup time means it would be redundant to duplicate them at class definition time. Code that interrogates __doc__ directly rather than using inspect.getdoc won't benefit from the new behaviour, but that's a quality of implementation question in the code handling the introspection. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:34 | admin | set | github: 59936 |
| 2016年02月08日 04:28:11 | ncoghlan | set | status: open -> closed resolution: out of date messages: + msg259813 stage: resolved |
| 2016年02月07日 18:20:32 | serhiy.storchaka | set | messages: + msg259796 |
| 2014年01月30日 06:20:02 | yselivanov | set | messages: + msg209706 |
| 2014年01月30日 05:55:10 | yselivanov | set | nosy:
+ yselivanov versions: + Python 3.5, - Python 3.4 |
| 2013年01月26日 15:20:39 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka |
| 2012年08月26日 20:13:06 | Arfrever | set | nosy:
+ Arfrever |
| 2012年08月25日 02:01:00 | cvrebert | set | nosy:
+ cvrebert |
| 2012年08月20日 11:17:49 | ncoghlan | set | files: - issue8810_reconcile_docs.patch |
| 2012年08月20日 11:17:09 | ncoghlan | set | messages: - msg168622 |
| 2012年08月20日 11:17:04 | ncoghlan | set | messages: - msg168621 |
| 2012年08月20日 10:41:25 | asvetlov | set | nosy:
+ asvetlov |
| 2012年08月20日 06:42:39 | bignose | set | messages: + msg168622 |
| 2012年08月20日 06:25:34 | bignose | set | files:
+ issue8810_reconcile_docs.patch nosy: + bignose messages: + msg168621 keywords: + patch |
| 2012年08月20日 04:40:40 | ncoghlan | set | messages: + msg168619 |
| 2012年08月20日 04:37:11 | ncoghlan | create | |