File tree 1 file changed +6
-5
lines changed 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 3
3
> ** Decorator** : Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative
4
4
> to subclassing for extending functionality.
5
5
6
- Not quite the same as
7
- python [ decorator syntax] ( https://docs.python.org/3/reference/compound_stmts.html#grammar-token-decorators )
8
- as in python you call the _ decorated function_ and the decorating function
9
- is called first whereas the _ decorating function_ must be called here.
10
-
11
6
I subclass ` ABC ` and used the ` @abstractmethod ` decorator from the
12
7
` abc ` module here but do not use any of this functionality -
13
8
it just serves as documentation.
14
9
10
+ ## Use in Python
11
+
12
+ The python [ decorator syntax] ( https://docs.python.org/3/reference/compound_stmts.html#grammar-token-decorators )
13
+ decorator syntax looks quite different as in python you call the _ decorated function_ and the decorating function
14
+ is automatically called first whereas the _ decorating function_ must be called according to the pattern in the book.
15
+
15
16
## Running the code
16
17
17
18
``` bash
You can’t perform that action at this time.
0 commit comments