Skip to content

Commit 9780b29

Browse files
committed
Merge pull request yasoob#32 from mafrasi2/master
Fixed some typos and one example for decorators
2 parents 5538a40 + 4149b2d commit 9780b29

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

decorators.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ decorators can make your code concise.
99

1010
Firstly let's discuss how to write your own decorator.
1111

12-
It is perhaps one of the most difficult concept to grasp. We will take
13-
it one step at a time so that you can fully inderstand it.
12+
It is perhaps one of the most difficult concepts to grasp. We will take
13+
it one step at a time so that you can fully understand it.
1414

1515
Everything in python is an object:
1616
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -205,9 +205,9 @@ Python. Now there is one problem with our code. If we run:
205205
print(a_function_requiring_decoration.__name__)
206206
# Output: wrapTheFunction
207207
208-
That's not what we expected! It's name is
208+
That's not what we expected! Its name is
209209
"a\_function\_requiring\_decoration". Well our function was replaced by
210-
wrapTheFunction. It overrided the name and docstring of our function.
210+
wrapTheFunction. It overrode the name and docstring of our function.
211211
Luckily Python provides us a simple function to solve this problem and
212212
that is ``functools.wraps``. Let's modify our previous example to use
213213
``functools.wraps``:
@@ -291,7 +291,7 @@ authentication:
291291
def decorated(*args, **kwargs):
292292
auth = request.authorization
293293
if not auth or not check_auth(auth.username, auth.password):
294-
return authenticate()
294+
authenticate()
295295
return f(*args, **kwargs)
296296
return decorated
297297

0 commit comments

Comments
 (0)