[issue34966] Pydoc: better support of method aliases

Serhiy Storchaka report at bugs.python.org
Fri Oct 12 11:50:11 EDT 2018


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

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.

----------
components: Library (Lib)
messages: 327593
nosy: serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: Pydoc: better support of method aliases
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34966>
_______________________________________


More information about the Python-bugs-list mailing list