Skip to content

Commit eb31a66

Browse files
committed
added private method naming convention
both static methods shouldn't be accessible from outside of the class.
1 parent 640cf76 commit eb31a66

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

catalog.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,29 @@ def __init__(self, param):
2121
# dictionary that will be used to determine which static method is
2222
# to be executed but that will be also used to store possible param
2323
# value
24-
self.static_method_choices = {'param_value_1': self.static_method_1,
25-
'param_value_2': self.static_method_2}
24+
self._static_method_choices = {'param_value_1': self._static_method_1,
25+
'param_value_2': self._static_method_2}
2626

2727
# simple test to validate param value
28-
if param in self.static_method_choices.keys():
28+
if param in self._static_method_choices.keys():
2929
self.param = param
3030
else:
3131
raise Exception("Invalid Value for Param: {0}".format(param))
3232

3333
@staticmethod
34-
def static_method_1():
34+
def _static_method_1():
3535
print("executed method 1!")
3636

3737
@staticmethod
38-
def static_method_2():
38+
def _static_method_2():
3939
print("executed method 2!")
4040

4141
def main_method(self):
4242
"""
43-
will execute either static_method_1 or static_method_2
43+
will execute either _static_method_1 or _static_method_2
4444
depending on self.param value
4545
"""
46-
self.static_method_choices[self.param]()
46+
self._static_method_choices[self.param]()
4747

4848

4949
def main():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy