Skip to content

Descriptors shouldn't be considered callable inside class definition #2267

Closed as not planned
@refi64

Description

@refi64

The following is an error in Python but passes mypy's checks:

class X:
    @staticmethod
    def f(): pass
    f()

Error:

Traceback (most recent call last):
  File "cls.py", line 1, in <module>
    class X:
  File "cls.py", line 4, in X
    f()
TypeError: 'staticmethod' object is not callable

Same thing goes for classmethod.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions