numinstances def __init__(self)spam numinstances spam numinstances @staticmethod def printnuminstances()print("number of instances created%sspam numinstancesfrom spam_static_deco import spam spam( spam( spam(spam printnuminstances(number of instances created printnuminstances(number of instances created calls from classes and instances work because they also accept and return functionsthe classmethod and property built-in functions may be used as decorators in the same way--as in the following mutation of the prior bothmethods pyfile bothmethods_decorators py class methods(object)def imeth(selfx)print([selfx]object needed in for property setters normal instance methodpassed self @staticmethod def smeth( )print([ ]staticno instance passed @classmethod def cmeth(clsx)print([clsx]classgets classnot instance @property propertycomputed on fetch def name(self)return 'bob self __class__ __name__ from bothmethods_decorators import methods obj methods(obj imeth( [ obj smeth( [ obj cmeth( [ obj name 'bob methodskeep in mind that staticmethod and its kin here are still built-in functionsthey may be used in decoration syntaxjust because they take function as an argument and return callable to which the original function name can be rebound in factany such advanced class topics