Skip to content

no error when marking a method as both staticmethod and classmethod #14506

@DetachHead

Description

@DetachHead
from typing import TypeVar 
from abc import ABC

Self = TypeVar("Self")

class Foo:
    @classmethod
    @staticmethod
    def foo(cls: type[Self]) -> Self:
        return cls()

playground

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions