Skip to content

Commit b4a0815

Browse files
reapply some improvements to code style section in different branch
1 parent 3f5bf4d commit b4a0815

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

docs/writing/style.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ One statement per line
5353

5454
While some compound statements such as list comprehensions are
5555
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.
5757

5858
**Bad**
5959

@@ -86,7 +86,7 @@ Function arguments
8686

8787
Arguments can be passed to functions in four different ways.
8888

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
9090
simplest form of arguments and they can be used for the few function arguments
9191
that are fully part of the functions meaning and their order is natural. For
9292
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
9999
reduces readability and is unnecessarily verbose, compared to the more straightforward
100100
calls to ``send('Hello', 'World')`` and ``point(1, 2)``.
101101

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
103103
used for optional parameters sent to the function. When a function has more than
104104
two or three positional parameters, its signature will be more difficult to remember
105105
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
121121
function) that was added "just in case" and is seemingly never used, than to add a
122122
new optional argument and its logic when needed.
123123

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
125125
function. If the function intention is better expressed by a signature with an
126126
extensible number of positional arguments, it can be defined with the ``*args``
127127
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',
139139
the recipient list as a list beforehand, and it opens the possibility to pass
140140
any sequence, including iterators, that cannot be unpacked as other sequences.
141141

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
143143
to functions. If the function requires an undetermined series of named
144144
arguments, it is possible to use the ``**kwargs`` construct. In the function
145145
body, ``kwargs`` will be a dictionary of all the passed named arguments that
@@ -166,9 +166,13 @@ Avoid the magical wand
166166

167167
A powerful tool for hackers, Python comes with a very rich set of hooks and
168168
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.
172176

173177
However, all these options have many drawbacks and it is always better to use
174178
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
181185
them is the most important.
182186

183187
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.
185189

186190
We are all consenting adults
187191
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)