File tree 3 files changed +12
-6
lines changed
3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
3
4
+
4
5
class Borg :
5
6
__shared_state = {}
6
7
Original file line number Diff line number Diff line change 2
2
# -*- coding: utf-8 -*-
3
3
4
4
"""
5
- A class that uses different static function depending of a parameter passed in init
6
- Note the use of a single dictionnary instead of multiple conditions
5
+ A class that uses different static function depending of a parameter passed in
6
+ init. Note the use of a single dictionnary instead of multiple conditions
7
7
"""
8
8
__author__ = "Ibrahim Diop <http://ibrahim.zinaria.com>"
9
9
__gist__ = "<https://gist.github.com/diopib/7679559>"
10
10
11
+
11
12
class Catalog ():
12
13
"""
13
- catalog of multiple static methods that are executed depending on an init parameter
14
+ catalog of multiple static methods that are executed depending on an init
15
+ parameter
14
16
"""
15
17
16
18
def __init__ (self , param ):
17
19
18
- # dictionary that will be used to determine which static method is to be executed but
19
- # that will be also used to store possible param value
20
- self .static_method_choices = {'param_value_1' : self .static_method_1 , 'param_value_2' : self .static_method_2 }
20
+ # dictionary that will be used to determine which static method is
21
+ # to be executed but that will be also used to store possible param
22
+ # value
23
+ self .static_method_choices = {'param_value_1' : self .static_method_1 ,
24
+ 'param_value_2' : self .static_method_2 }
21
25
22
26
# simple test to validate param value
23
27
if param in self .static_method_choices .keys ():
Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
# -*- coding: utf-8 -*-
3
3
4
+
4
5
class GraphSearch :
5
6
"""Graph search emulation in python, from source
6
7
http://www.python.org/doc/essays/graphs/"""
You can’t perform that action at this time.
0 commit comments