8
8
__gist__ = "<https://gist.github.com/diopib/7679559>"
9
9
10
10
11
- class Catalog ():
11
+ class Catalog (object ):
12
+ """catalog of multiple static methods that are executed depending on an init
12
13
13
- """
14
- catalog of multiple static methods that are executed depending on an init
15
14
parameter
16
15
"""
17
16
@@ -38,18 +37,18 @@ def _static_method_2():
38
37
print ("executed method 2!" )
39
38
40
39
def main_method (self ):
41
- """
42
- will execute either _static_method_1 or _static_method_2
40
+ """will execute either _static_method_1 or _static_method_2
41
+
43
42
depending on self.param value
44
43
"""
45
44
self ._static_method_choices [self .param ]()
46
45
47
46
48
47
# Alternative implementation for different levels of methods
49
- class CatalogInstance :
48
+ class CatalogInstance (object ):
49
+
50
+ """catalog of multiple methods that are executed depending on an init
50
51
51
- """
52
- catalog of multiple methods that are executed depending on an init
53
52
parameter
54
53
"""
55
54
@@ -72,17 +71,17 @@ def _instance_method_2(self):
72
71
'param_value_2' : _instance_method_2 }
73
72
74
73
def main_method (self ):
75
- """
76
- will execute either _instance_method_1 or _instance_method_2
74
+ """will execute either _instance_method_1 or _instance_method_2
75
+
77
76
depending on self.param value
78
77
"""
79
78
self ._instance_method_choices [self .param ].__get__ (self )()
80
79
81
80
82
- class CatalogClass :
81
+ class CatalogClass (object ):
82
+
83
+ """catalog of multiple class methods that are executed depending on an init
83
84
84
- """
85
- catalog of multiple class methods that are executed depending on an init
86
85
parameter
87
86
"""
88
87
@@ -108,17 +107,17 @@ def _class_method_2(cls):
108
107
'param_value_2' : _class_method_2 }
109
108
110
109
def main_method (self ):
111
- """
112
- will execute either _class_method_1 or _class_method_2
110
+ """will execute either _class_method_1 or _class_method_2
111
+
113
112
depending on self.param value
114
113
"""
115
114
self ._class_method_choices [self .param ].__get__ (None , self .__class__ )()
116
115
117
116
118
- class CatalogStatic :
117
+ class CatalogStatic (object ):
118
+
119
+ """catalog of multiple static methods that are executed depending on an init
119
120
120
- """
121
- catalog of multiple static methods that are executed depending on an init
122
121
parameter
123
122
"""
124
123
@@ -141,8 +140,8 @@ def _static_method_2():
141
140
'param_value_2' : _static_method_2 }
142
141
143
142
def main_method (self ):
144
- """
145
- will execute either _static_method_1 or _static_method_2
143
+ """will execute either _static_method_1 or _static_method_2
144
+
146
145
depending on self.param value
147
146
"""
148
147
self ._static_method_choices [self .param ].__get__ (None , self .__class__ )()
0 commit comments