File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
33
4+
45class Borg :
56 __shared_state = {}
67
Original file line number Diff line number Diff line change 22# -*- coding: utf-8 -*-
33
44"""
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
77"""
88__author__ = "Ibrahim Diop <http://ibrahim.zinaria.com>"
99__gist__ = "<https://gist.github.com/diopib/7679559>"
1010
11+
1112class Catalog ():
1213 """
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
1416 """
1517
1618 def __init__ (self , param ):
1719
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 }
2125
2226 # simple test to validate param value
2327 if param in self .static_method_choices .keys ():
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# -*- coding: utf-8 -*-
33
4+
45class GraphSearch :
56 """Graph search emulation in python, from source
67 http://www.python.org/doc/essays/graphs/"""
You can’t perform that action at this time.
0 commit comments