@@ -9,8 +9,8 @@ decorators can make your code concise.
99
1010Firstly 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
1515Everything 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.
211211Luckily Python provides us a simple function to solve this problem and
212212that 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