File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
4_experiments/2_standard_library/29_python_runtime_services/9_abcs/2_decorators Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import abc
2+ from abc import abstractmethod
3+
4+ class TestClassMethodDecorator ():
5+ @staticmethod
6+ def method_static_method ():
7+ print ("In static method" )
8+
9+ @classmethod
10+ def method_class_method (cls ):
11+ print ("In class method" )
12+
13+ @abstractmethod
14+ def method_abstract (self ):
15+ print ("In abstract method" )
16+
17+ @staticmethod
18+ @abstractmethod
19+ def method_abstract_static ():
20+ print ("In abstract static method" )
21+
22+ def invoke_method_static_method_in_class (self ):
23+ """
24+ Q: why can't we do this?
25+ """
26+ method_static_method ()
27+
28+
29+ if __name__ == "__main__" :
30+ print (f"Test: { TestClassMethodDecorator .__name__ } " )
31+ a = TestClassMethodDecorator ()
32+ a .method_static_method ()
33+ TestClassMethodDecorator .method_static_method ()
34+ # a.invoke_method_static_method_in_class()
35+
36+ a .method_abstract ()
37+ # TestClassMethodDecorator.method_abstract()
38+ TestClassMethodDecorator .method_abstract_static ()
39+
40+ a .method_class_method ()
41+ TestClassMethodDecorator .method_class_method ()
42+
43+ print (abc .get_cache_token ())
44+ print (type (abc .get_cache_token ()))
You can’t perform that action at this time.
0 commit comments