Skip to content

Commit aa57dd5

Browse files
committed
🎨 Rearrange module section
1 parent 084912a commit aa57dd5

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

docs/modules/index.rst

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,18 @@ What is a module?
1111

1212
A module is a file that contains code. It defines a group of Python functions or
1313
other objects, and the name of the module is derived from the name of the file.
14-
Modules usually contain Python source code, but can also be compiled C or C++
15-
object files. Compiled modules and Python source modules are used in the same
16-
way.
17-
18-
Modules not only group related Python objects together, but also help to avoid
19-
naming conflicts. You can write a module called ``mymodule`` for your programme
20-
that defines a function called ``my_func``. In the same programme, you may also
21-
want to use another module called ``othermodule``, which also defines a
22-
function called ``my_func``, but does something different from your ``my_func``
23-
function. Without modules, it would be impossible to use two different functions
24-
with the same name. With modules, you can refer to the functions
25-
``mymodule.my_func`` and ``othermodule.my_func`` in your main programme. Using
26-
the module names ensures that the two ``my_func`` functions are not confused, as
27-
Python uses so-called namespaces. A namespace is essentially a dictionary of
28-
names for the functions, classes, modules, :abbr:`etc. (et cetera)` available
29-
there.
14+
Modules usually contain Python source code[#]_, group related Python objects
15+
together and help to avoid naming conflicts. You can write a module called
16+
``mymodule`` for your programme that defines a function called ``my_func``. In
17+
the same programme, you may also want to use another module called
18+
``othermodule``, which also defines a function called ``my_func``, but does
19+
something different from your ``my_func`` function. Without modules, it would be
20+
impossible to use two different functions with the same name. With modules, you
21+
can refer to the functions ``mymodule.my_func`` and ``othermodule.my_func`` in
22+
your main programme. Using the module names ensures that the two ``my_func``
23+
functions are not confused, as Python uses so-called namespaces. A namespace is
24+
essentially a dictionary of names for the functions, classes, modules,
25+
:abbr:`etc. (et cetera)` available there.
3026

3127
Modules are also used to make Python itself more manageable. Most of Python’s
3228
standard functions are not integrated into the core of the language, but are
@@ -202,3 +198,9 @@ Checks
202198
from another script.
203199

204200
* Make your module executable.
201+
202+
----
203+
204+
.. [#] Although modules usually contain Python source code, they can also be
205+
compiled C or C++ object files. Compiled modules and Python source modules
206+
are used in the same way.

0 commit comments

Comments
 (0)