Issue34966
Created on 2018-10-12 15:50 by serhiy.storchaka, last changed 2018-11-08 07:24 by serhiy.storchaka. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 9823 | merged | serhiy.storchaka, 2018-10-12 15:59 | |
| PR 10407 | merged | miss-islington, 2018-11-08 06:48 | |
| PR 10408 | merged | miss-islington, 2018-11-08 06:48 | |
| Messages (6) | |||
|---|---|---|---|
| msg327593 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-10-12 15:50 | |
Pydoc supports aliases. If the alias is defined in the same class
class A:
def foo(self, x=42): pass
bar = foo
it will render the docstring only for the original function. For the alias it will output just "bar = foo(self, x=42)".
But this doesn't work if the original function or alias are inherited. It often happened in the tkinter and turtle modules which have a hierarchy of classes, and aliases defined in parent classes. Compare for example the rendering for methods itemconfig and lift in help(tkinter.Listbox).
The proposed PR makes pydoc detecting aliases for inherited methods.
|
|||
| msg327608 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2018-10-12 18:27 | |
What do you mean by 'does not work'. Alias of function in same namespace. | itemconfig = itemconfigure(self, index, cnf=None, **kw) | | itemconfigure(self, index, cnf=None, **kw) | Configure resources of an ITEM. Alias of function in inherited namespace. | lift = tkraise(self, aboveThis=None) | Raise this widget in the stacking order. This is also marked as an alias. The difference is the inclusions of the docstring of the original. I think it should be, since it would not otherwise be present in the help output. |
|||
| msg327609 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-10-12 18:51 | |
The original function is present too. | tkraise(self, aboveThis=None) | Raise this widget in the stacking order. |
|||
| msg329456 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2018-11-08 06:48 | |
New changeset a44d34e17908a49d584f86c4f8642a50707b7150 by Serhiy Storchaka in branch 'master': bpo-34966: Improve support of method aliases in pydoc. (GH-9823) https://github.com/python/cpython/commit/a44d34e17908a49d584f86c4f8642a50707b7150 |
|||
| msg329458 - (view) | Author: miss-islington (miss-islington) | Date: 2018-11-08 07:08 | |
New changeset 9d3658147b56e24e96e174510b6ee91c8141e530 by Miss Islington (bot) in branch '3.7': bpo-34966: Improve support of method aliases in pydoc. (GH-9823) https://github.com/python/cpython/commit/9d3658147b56e24e96e174510b6ee91c8141e530 |
|||
| msg329459 - (view) | Author: miss-islington (miss-islington) | Date: 2018-11-08 07:20 | |
New changeset 11a33e171b89ea9267672b0664d739ca06e459ca by Miss Islington (bot) in branch '3.6': bpo-34966: Improve support of method aliases in pydoc. (GH-9823) https://github.com/python/cpython/commit/11a33e171b89ea9267672b0664d739ca06e459ca |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2018-11-08 07:24:13 | serhiy.storchaka | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: - Python 2.7 |
| 2018-11-08 07:20:31 | miss-islington | set | messages: + msg329459 |
| 2018-11-08 07:08:09 | miss-islington | set | nosy:
+ miss-islington messages: + msg329458 |
| 2018-11-08 06:48:33 | miss-islington | set | pull_requests: + pull_request9692 |
| 2018-11-08 06:48:27 | miss-islington | set | pull_requests: + pull_request9691 |
| 2018-11-08 06:48:15 | serhiy.storchaka | set | messages: + msg329456 |
| 2018-10-29 18:33:35 | serhiy.storchaka | set | assignee: serhiy.storchaka |
| 2018-10-12 18:51:47 | serhiy.storchaka | set | messages: + msg327609 |
| 2018-10-12 18:27:58 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg327608 |
| 2018-10-12 15:59:57 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request9200 |
| 2018-10-12 15:50:11 | serhiy.storchaka | create | |