File tree Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Expand file tree Collapse file tree 5 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ was used to develop it.
25
25
1 . ` testing ` : illustrates writing unit tests with ` unittest ` and
26
26
` pytest ` .
27
27
1 . ` oo_vs_functional.ipynb ` : comparing object-oriented approach to
28
- functional approach, including coroutines.
28
+ functional approach, including coroutines.
29
29
1 . ` metaclasses ` : illustration of the use of metaclasses in Python.
30
30
1 . ` data-structures ` : illustration of Python and standard library data
31
31
structures.
32
+ 1 . ` code-organization ` : illustration of how to organize code in packages
33
+ and modules.
Original file line number Diff line number Diff line change
1
+ # Code organization
2
+
3
+ Simple example of code organization in packages, modules.
4
+
5
+ ## What is it?
6
+
7
+ 1 . ` my_pkg ` : Python package.
8
+ 1 . ` __init__.py ` : package-level documentation and version
9
+ information.
10
+ 1 . ` my_module.py ` : simple module in the ` my_pkg ` package.
11
+ 1 . ` my_script.py ` : Python script that uses the ` my_module `
12
+ module in the ` my_pkg ` package.
Original file line number Diff line number Diff line change
1
+ '''
2
+ This is the my_pkg documentation
3
+ '''
4
+
5
+ __version__ = '1.0'
Original file line number Diff line number Diff line change
1
+ def hello (name ):
2
+ return f'hello { name } '
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import my_pkg .my_module
4
+
5
+ print (my_pkg .my_module .hello ('world' ))
You can’t perform that action at this time.
0 commit comments