Skip to content

Documentation says that static methods can be called as regular functions, but I don't see how from the documentation #117903

@khatchad

Description

@khatchad

Documentation

The documentation states that static methods can be called as "regular" functions, but I don't see how that's possible from the documentation.

Moreover, they can be called as regular functions (such as f()).

I tried the following example that didn't work:

class C:
    @staticmethod
    def the_static_method(x):
        pass

the_static_method(5)

I get:

Traceback (most recent call last):
  File "....py", line 6, in <module>
    the_static_method(5)
NameError: name 'the_static_method' is not defined. Did you mean: 'staticmethod'?

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions