@@ -41,7 +41,7 @@ most explicit and straightforward manner is preferred.
41
41
def make_complex(x, y):
42
42
return {' x' : x, ' y' : y}
43
43
44
- In the good code above, x and y are explicitely received from
44
+ In the good code above, x and y are explicitly received from
45
45
the caller, and an explicit dictionary is returned. The developer
46
46
using this function knows exactly what to do by reading the
47
47
first and last lines, which is not the case with the bad example.
@@ -50,7 +50,7 @@ One statement per line
50
50
~~~~~~~~~~~~~~~~~~~~~~
51
51
52
52
While some compound statements such as list comprehensions are
53
- allowed and appreciated for their brevity and their expressivity ,
53
+ allowed and appreciated for their brevity and their expressiveness ,
54
54
it is bad practice to have two disjoint statements on the same line.
55
55
56
56
** Bad**
@@ -107,10 +107,10 @@ passed another value.
107
107
108
108
Calling a function with keyword arguments can be done in multiple ways in Python,
109
109
for example it is possible to follow the order of arguments in the definition without
110
- explicitely naming the arguments, like in `` send(' Hello' , ' World' , ' Cthulhu`, ' God' )``,
110
+ explicitly naming the arguments, like in `` send(' Hello' , ' World' , ' Cthulhu`, ' God' )``,
111
111
sending a blank carbon copy to God. It would also be possible to name arguments in
112
112
another order, like in `` send(' Hello again' , ' World' , bcc = ' God' , cc = ' Cthulhu' )`` .
113
- Those two possibilities are better avoided whitout any strong reason to not
113
+ Those two possibilities are better avoided without any strong reason to not
114
114
follow the syntax that is the closest to the function definition: `` send(' Hello' ,
115
115
' World' , cc = ' Cthulhu' , bcc = ' God' )`` .
116
116
@@ -132,13 +132,13 @@ However, this construct has some drawback and should be used with caution. If a
132
132
function receives a list of arguments of the same nature, it is often more
133
133
clear to define it as a function of one argument, that argument being a list or
134
134
any sequence. Here, if `` send`` has multiple recipients, it is better to define
135
- it explicitely : `` send(message, recipients)`` and call it with `` send(' Hello' ,
135
+ it explicitly : `` send(message, recipients)`` and call it with `` send(' Hello' ,
136
136
[' God' , ' Mom' , ' Cthulhu' ])`` . This way, the user of the function can manipulate
137
- the recipient list as a list beforhand , and it opens the possibility to pass
138
- any sequence, inculding iterators, that cannot be unpacked as other sequences.
137
+ the recipient list as a list beforehand , and it opens the possibility to pass
138
+ any sequence, including iterators, that cannot be unpacked as other sequences.
139
139
140
140
The ** arbitrary keyword argument dictionary** is the last way to pass arguments
141
- to functions. If the function requires an undetermined serie of named
141
+ to functions. If the function requires an undetermined series of named
142
142
arguments, it is possible to used the `` ** kwargs`` construct. In the function
143
143
body, `` kwargs`` will be a dictionary of all the passed named arguments that
144
144
have not been caught be other keyword argument in the function signature.
@@ -149,8 +149,8 @@ proven necessity to use them, and they should not be used if the simpler and
149
149
clearer construct is sufficient to express the function' s intention.
150
150
151
151
It is up to the programmer writing the function to determine which arguments
152
- are positional argmuents and which are optional keyword arguments, and to
153
- decide wheter to use the advanced techniques of arbitrary argument passing. If
152
+ are positional arguments and which are optional keyword arguments, and to
153
+ decide whether to use the advanced techniques of arbitrary argument passing. If
154
154
the advices above are followed wisely, it is possible and enjoyable to write
155
155
Python functions that are:
156
156
@@ -164,7 +164,7 @@ Avoid the magical wand
164
164
165
165
A powerful tool for hackers, Python comes with a very rich set of hooks and
166
166
tools allowing to do almost any kind of tricky tricks. For instance, it is
167
- possible to change how objects are created and instanciated , it is possible to
167
+ possible to change how objects are created and instantiated , it is possible to
168
168
change how the Python interpreter imports modules, it is even possible (and
169
169
recommended if needed) to embed C routines in Python.
170
170
@@ -222,7 +222,7 @@ output point in the body.
222
222
223
223
There are two main cases for returning values in a function: The result of the function
224
224
return when it has been processed normally, and the error cases that indicate a wrong
225
- input paramter or any other reason for the function to not be able to complete its
225
+ input parameter or any other reason for the function to not be able to complete its
226
226
computation or task.
227
227
228
228
If you do not wish to raise exceptions for the second case, then returning a value, such
@@ -610,7 +610,7 @@ sometime but is preferably avoided, because of its fragility: a white space
610
610
added to the end of the line, after the backslash, will break the code and may
611
611
have unexpected results.
612
612
613
- A prefered solution is to use parenthesis around your elements. Left with an
613
+ A preferred solution is to use parenthesis around your elements. Left with an
614
614
unclosed parenthesis on an end- of- line the Python interpreter will join the
615
615
next line until the parenthesis is closed. The same behavior holds for curly
616
616
and square braces.
@@ -624,7 +624,7 @@ and square braces.
624
624
time to say “I’m going to sleep.”"""
625
625
626
626
from some.deep.module.inside.a.module import a_nice_function, another_nice_function, \
627
- yet_another_nice_functio
627
+ yet_another_nice_function
628
628
629
629
** Good** :
630
630
0 commit comments