@@ -53,7 +53,7 @@ One statement per line
53
53
54
54
While some compound statements such as list comprehensions are
55
55
allowed and appreciated for their brevity and their expressiveness,
56
- it is bad practice to have two disjoint statements on the same line.
56
+ it is bad practice to have two disjoint statements on the same line of code .
57
57
58
58
**Bad **
59
59
@@ -86,7 +86,7 @@ Function arguments
86
86
87
87
Arguments can be passed to functions in four different ways.
88
88
89
- **Positional arguments ** are mandatory and have no default values. They are the
89
+ 1. **Positional arguments ** are mandatory and have no default values. They are the
90
90
simplest form of arguments and they can be used for the few function arguments
91
91
that are fully part of the functions meaning and their order is natural. For
92
92
instance, in ``send(message, recipient) `` or ``point(x, y) `` the user of the
@@ -99,7 +99,7 @@ and, doing so, it is possible to switch the order of arguments, calling for inst
99
99
reduces readability and is unnecessarily verbose, compared to the more straightforward
100
100
calls to ``send('Hello', 'World') `` and ``point(1, 2) ``.
101
101
102
- **Keyword arguments ** are not mandatory and have default values. They are often
102
+ 2. **Keyword arguments ** are not mandatory and have default values. They are often
103
103
used for optional parameters sent to the function. When a function has more than
104
104
two or three positional parameters, its signature will be more difficult to remember
105
105
and using keyword argument with default values is helpful. For instance, a more
@@ -121,7 +121,7 @@ principle, it is often harder to remove an optional argument (and its logic insi
121
121
function) that was added "just in case" and is seemingly never used, than to add a
122
122
new optional argument and its logic when needed.
123
123
124
- The **arbitrary argument list ** is the third way to pass arguments to a
124
+ 3. The **arbitrary argument list ** is the third way to pass arguments to a
125
125
function. If the function intention is better expressed by a signature with an
126
126
extensible number of positional arguments, it can be defined with the ``*args ``
127
127
constructs. In the function body, ``args `` will be a tuple of all the
@@ -139,7 +139,7 @@ it explicitly: ``send(message, recipients)`` and call it with ``send('Hello',
139
139
the recipient list as a list beforehand, and it opens the possibility to pass
140
140
any sequence, including iterators, that cannot be unpacked as other sequences.
141
141
142
- The **arbitrary keyword argument dictionary ** is the last way to pass arguments
142
+ 4. The **arbitrary keyword argument dictionary ** is the last way to pass arguments
143
143
to functions. If the function requires an undetermined series of named
144
144
arguments, it is possible to use the ``**kwargs `` construct. In the function
145
145
body, ``kwargs `` will be a dictionary of all the passed named arguments that
@@ -166,9 +166,13 @@ Avoid the magical wand
166
166
167
167
A powerful tool for hackers, Python comes with a very rich set of hooks and
168
168
tools allowing to do almost any kind of tricky tricks. For instance, it is
169
- possible to change how objects are created and instantiated, it is possible to
170
- change how the Python interpreter imports modules, it is even possible (and
171
- recommended if needed) to embed C routines in Python.
169
+ possible to do each of the following:
170
+
171
+ * change how objects are created and instantiated
172
+
173
+ * change how the Python interpreter imports modules
174
+
175
+ * it is even possible (and recommended if needed) to embed C routines in Python.
172
176
173
177
However, all these options have many drawbacks and it is always better to use
174
178
the most straightforward way to achieve your goal. The main drawback is that
@@ -181,7 +185,7 @@ way. However, knowing how to use them and particularly when **not** to use
181
185
them is the most important.
182
186
183
187
Like a Kungfu master, a Pythonista knows how to kill with a single finger, and
184
- never to do it.
188
+ never to actually do it.
185
189
186
190
We are all consenting adults
187
191
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 commit comments