tpcp.misc.classproperty(method: Callable[[Concatenate[type[T], P]], R] | None = None)[source]#

A decorator that converts a class method into a class property.

This decorator allows a class method, which takes the class as its only argument, to be accessed directly from the class as a property. This can be useful when you want to compute a value that is associated with the class, but not with any specific instance of the class.

This implementation is taken from Django and slightly modified: The original version in Django is published under the BSD license.