@@ -149,29 +149,29 @@ Packages
149149Python provides a very straightforward packaging system, which is simply an
150150extension of the module mechanism to a directory.
151151
152- Any directory with a __init__.py file is considered a Python package. The
152+ Any directory with an __init__.py file is considered a Python package. The
153153different modules in the package are imported in a similar manner as plain
154- modules, will a special behavior for the __init__.py file, that is used to
154+ modules, but with a special behavior for the __init__.py file, which is used to
155155gather all package-wide definitions.
156156
157157A file modu.py in the directory pack/ is imported with the statement `import
158- pack.modu `. This statement will look for a __init__.py file in `pack `, execute
159- all its top-level statements. Then it will look for a file `pack/modu.py ` and
160- execute all its top-level statements. After these operations, any variable,
161- function or class defined in modu.py is available in pack.modu namespace.
158+ pack.modu `. This statement will look for an __init__.py file in `pack `, execute
159+ all of its top-level statements. Then it will look for a file `pack/modu.py ` and
160+ execute all of its top-level statements. After these operations, any variable,
161+ function, or class defined in modu.py is available in the pack.modu namespace.
162162
163- A commonly seen issue is to add too many code and functions in __init__.py
163+ A commonly seen issue is to add too much code to __init__.py
164164files. When the project complexity grows, there may be sub-packages and
165- sub-sub-packages in a deep directory structure, and then, import a single item
166- from a sub-sub-package will require to execute all __init__.py file met while
167- descending the tree.
165+ sub-sub-packages in a deep directory structure, and then, importing a single item
166+ from a sub-sub-package will require executing all __init__.py files met while
167+ traversing the tree.
168168
169- Leaving a __init__.py file empty is considered normal and even a good pratice ,
169+ Leaving an __init__.py file empty is considered normal and even a good practice ,
170170if the package's modules and sub-packages do not need to share any code.
171171
172172Lastly, a convenient syntax is available for importing deeply nested packages:
173- `import very.deep.module as mod ` allow to use `mod ` in place of the verbose
174- repetition of `very.deep.module ` in front of each calls to module items .
173+ `import very.deep.module as mod `. This allows you to use `mod ` in place of the verbose
174+ repetition of `very.deep.module `.
175175
176176Object-oriented programming
177177---------------------------
0 commit comments