Skip to content

help() of a method wrongly identifies it as a module-level function #94506

Open

Description

@stevendaprano

Consider the following class:

class K:
    def verbify(self):
        """Docstring"""

help() on the unbound method (actually a function) K.verbify wrongly identifies it as a module-level function, displaying this in Python3.10:

Help on function verbify in module __main__:

verbify(self)
    Docstring

It should identify the function using __qualname__ rather than __name__':

>>> K.verbify.__qualname__
'K.verbify'
>>> K.verbify.__name__
'verbify'

In contrast, help() on the bound method correctly identifies that verbify is a method belonging to K: help(K().verbify) displays verbify() method of __main__.K instance.

Linked PRs

Activity

  1. added
    type-bug
    on Jul 2, 2022
  2. added
    3.11
    3.10 (EOL)
    3.12
    and removed
    3.10 (EOL)
    on Apr 6, 2023
  3. added
    stdlib
    3.13
    on Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.113.123.13stdlibtype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions