Skip to content

Pydoc: better support of method aliases #79147

Closed

Description

@serhiy-storchaka
BPO 34966
Nosy @terryjreedy, @serhiy-storchaka, @1st1, @miss-islington
PRs
  • bpo-34966: Improve support of method aliases in pydoc. #9823
  • [3.7] bpo-34966: Improve support of method aliases in pydoc. (GH-9823) #10407
  • [3.6] bpo-34966: Improve support of method aliases in pydoc. (GH-9823) #10408
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2018-11-08.07:24:13.687>
    created_at = <Date 2018-10-12.15:50:11.626>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'Pydoc: better support of method aliases'
    updated_at = <Date 2018-11-08.07:24:13.686>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-11-08.07:24:13.686>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2018-11-08.07:24:13.687>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2018-10-12.15:50:11.626>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34966
    keywords = ['patch']
    message_count = 6.0
    messages = ['327593', '327608', '327609', '329456', '329458', '329459']
    nosy_count = 4.0
    nosy_names = ['terry.reedy', 'serhiy.storchaka', 'yselivanov', 'miss-islington']
    pr_nums = ['9823', '10407', '10408']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34966'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    Activity

    1. serhiy-storchaka commented on Oct 12, 2018

      @serhiy-storchaka
      MemberAuthor

      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.

    2. added
      3.7 (EOL)
      3.8 (EOL)
      stdlib
      type-bug
      on Oct 12, 2018
    3. terryjreedy commented on Oct 12, 2018

      @terryjreedy
      Member

      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.

    4. serhiy-storchaka commented on Oct 12, 2018

      @serhiy-storchaka
      MemberAuthor

      The original function is present too.

      | tkraise(self, aboveThis=None)
      | Raise this widget in the stacking order.

    5. serhiy-storchaka commented on Nov 8, 2018

      @serhiy-storchaka
      MemberAuthor

      New changeset a44d34e by Serhiy Storchaka in branch 'master':
      bpo-34966: Improve support of method aliases in pydoc. (GH-9823)
      a44d34e

    6. miss-islington commented on Nov 8, 2018

      @miss-islington
      Contributor

      New changeset 9d36581 by Miss Islington (bot) in branch '3.7':
      bpo-34966: Improve support of method aliases in pydoc. (GH-9823)
      9d36581

    7. miss-islington commented on Nov 8, 2018

      @miss-islington
      Contributor

      New changeset 11a33e1 by Miss Islington (bot) in branch '3.6':
      bpo-34966: Improve support of method aliases in pydoc. (GH-9823)
      11a33e1

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    3.7 (EOL)3.8 (EOL)stdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions