@@ -30,7 +30,7 @@ First of all let's understand functions in python:
3030 # We are not using parentheses here because we are not calling the function hi
3131 # instead we are just putting it into the greet variable. Let's try to run this
3232
33- print greet()
33+ print ( greet() )
3434 # output: 'hi yasoob'
3535
3636 # Let's see what happens if we delete the old hi function!
@@ -51,7 +51,7 @@ other functions:
5151.. code :: python
5252
5353 def hi (name = " yasoob" ):
54- print " now you are inside the hi() function"
54+ print ( " now you are inside the hi() function" )
5555
5656 def greet ():
5757 return " now you are in the greet() function"
@@ -131,11 +131,11 @@ Giving a function as an argument to another function:
131131 return " hi yasoob!"
132132
133133 def doSomethingBeforeHi (func ):
134- print (" I am doing some boring work before executing hi()" )
134+ print (" I am doing some boring work before executing hi()" )
135135 print (func())
136136
137137 doSomethingBeforeHi(hi)
138- # outputs:I am doing some boring work before executing hi()
138+ # outputs:I am doing some boring work before executing hi()
139139 # hi yasoob!
140140
141141 Now you have all the required knowledge to learn what decorators really
@@ -152,7 +152,7 @@ previous decorator and make a little bit more usable program:
152152 def a_new_decorator (a_func ):
153153
154154 def wrapTheFunction ():
155- print " I am doing some boring work before executing a_func()"
155+ print ( " I am doing some boring work before executing a_func()" )
156156
157157 a_func()
158158
@@ -170,7 +170,7 @@ previous decorator and make a little bit more usable program:
170170 # now a_function_requiring_decoration is wrapped by wrapTheFunction()
171171
172172 a_function_requiring_decoration()
173- # outputs:I am doing some boring work before executing a_function_requiring_decoration()
173+ # outputs:I am doing some boring work before executing a_function_requiring_decoration()
174174 # I am the function which needs some decoration to remove my foul smell
175175 # I am doing some boring work after executing a_function_requiring_decoration()
176176
@@ -185,12 +185,12 @@ run the previous code sample using @.
185185
186186 @a_new_decorator
187187 def a_function_requiring_decoration ():
188- """ Hey yo ! Decorate me!"""
188+ """ Hey you ! Decorate me!"""
189189 print (" I am the function which needs some decoration to "
190- " remove my foul smell" )
190+ " remove my foul smell" )
191191
192192 a_function_requiring_decoration()
193- # outputs: I am doing some boring work before executing a_function_requiring_decoration()
193+ # outputs: I am doing some boring work before executing a_function_requiring_decoration()
194194 # I am the function which needs some decoration to remove my foul smell
195195 # I am doing some boring work after executing a_function_requiring_decoration()
196196
@@ -219,7 +219,7 @@ that is ``functools.wraps``. Let's modify our previous example to use
219219 def a_new_decorator (a_func ):
220220 @wraps (a_func)
221221 def wrapTheFunction ():
222- print (" I am doing some boring work before executing a_func()" )
222+ print (" I am doing some boring work before executing a_func()" )
223223 a_func()
224224 print (" I am doing some boring work after executing a_func()" )
225225 return wrapTheFunction
@@ -236,7 +236,7 @@ that is ``functools.wraps``. Let's modify our previous example to use
236236 Now that is much better. Let's move on and learn some use-cases of
237237decorators.
238238
239- **Blueprint : **
239+ **Blueprint: **
240240
241241.. code :: python
242242
@@ -313,7 +313,7 @@ Logging is another area where the decorators shine. Here is an example:
313313
314314 @logit
315315 def addition_func (x ):
316- """ does some math"""
316+ """ Do some math. """
317317 return x + x
318318
319319
0 commit comments