Skip to main content

classonlymethod

This class is a specialized decorator that restricts a method's access exclusively to the class level, preventing it from being called by instances. It inherits from the built-in classmethod and raises an AttributeError if an attempt is made to access the decorated method through an instance.

Constructor

Signature

def classonlymethod(
method: callable
) - > null

Parameters

NameTypeDescription
methodcallableThe function to be wrapped as a class-only method.