You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-5Lines changed: 28 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,8 @@ python-patterns
3
3
4
4
A collection of design patterns and idioms in Python.
5
5
6
-
When an implementation is added or modified, be sure to update this file and
7
-
rerun `append_output.sh` (eg. ./append_output.sh borg.py) to keep the output
8
-
comments at the bottom up to date.
9
-
10
-
Current Patterns:
6
+
Current Patterns
7
+
----------------
11
8
12
9
__Creational Patterns__:
13
10
@@ -75,3 +72,29 @@ __Others__:
75
72
|[blackboard](other/blackboard.py)| architectural model, assemble different sub-system knowledge to build a solution, AI approach - non gang of four pattern |
76
73
|[graph_search](other/graph_search.py)| graphing algorithms - non gang of four pattern |
77
74
|[hsm](other/hsm/hsm.py)| hierarchical state machine - non gang of four pattern |
75
+
76
+
77
+
Contributing
78
+
------------
79
+
When an implementation is added or modified, please review the following guidelines:
80
+
81
+
##### Output
82
+
All files with example patterns have `### OUTPUT ###` section at the bottom.
83
+
84
+
Run `append_output.sh` (e.g. `./append_output.sh borg.py`) to generate/update it.
85
+
86
+
##### Docstrings
87
+
Add module level description in form of a docstring with links to corresponding references or other useful information.
88
+
89
+
[strategy.py](behavioral/strategy.py) has a good example of detailed description,
90
+
but sometimes the shorter one as in [template.py](behavioral/template.py) would suffice.
91
+
92
+
In some cases class-level docstring with doctest would also help (see [adapter.py](structural/adapter.py))
93
+
94
+
##### Python2/3 compatibility
95
+
Try to keep it (discussion is held in [issue #208](https://github.com/faif/python-patterns/issues/208))
96
+
- use new style classes (inherit from `object`)
97
+
- use `from future import print`
98
+
99
+
##### Update README
100
+
When everything else is done - update corresponding part of README.
0 commit comments