@@ -289,7 +289,9 @@ \section{PEP 318: Decorators for Functions and Methods}
289289the following:
290290
291291\begin {verbatim }
292- @A @B @C
292+ @A
293+ @B
294+ @C
293295def f ():
294296 ...
295297\end {verbatim }
@@ -301,16 +303,18 @@ \section{PEP 318: Decorators for Functions and Methods}
301303f = A(B(C(f)))
302304\end {verbatim }
303305
304- Decorators must come on the line before a function definition, and
305- can't be on the same line, meaning that \code {@A def f(): ...} is
306- illegal. You can only decorate function definitions, either at the
307- module level or inside a class; you can't decorate class definitions.
308-
309- A decorator is just a function that takes the function to be decorated
310- as an argument and returns either the same function or some new
311- callable thing. It's easy to write your own decorators. The
312- following simple example just sets an attribute on the function
313- object:
306+ Decorators must come on the line before a function definition, one decorator
307+ per line, and can't be on the same line as the def statement, meaning that
308+ \code {@A def f(): ...} is illegal. You can only decorate function
309+ definitions, either at the module level or inside a class; you can't
310+ decorate class definitions.
311+
312+ A decorator is just a function that takes the function to be decorated as an
313+ argument and returns either the same function or some new object. The
314+ return value of the decorator need not be callable (though it typically is),
315+ unless further decorators will be applied to the result. It's easy to write
316+ your own decorators. The following simple example just sets an attribute on
317+ the function object:
314318
315319\begin {verbatim }
316320>>> def deco(func):
0 commit comments