You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapter03_decorator/readme.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,6 @@
2
2
3
3
**Decorator**: Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.
4
4
5
-
Not quite the same as python decorator syntax as in python you call the _decorated function_ and the decorating function is called first whereas the _decorating function_ must be called here.
5
+
Not quite the same as python [decorator syntax](https://docs.python.org/3/reference/compound_stmts.html#grammar-token-decorators) as in python you call the _decorated function_ and the decorating function is called first whereas the _decorating function_ must be called here.
6
6
7
7
I subclass `ABC` and used the `@abstractmethod` decorator from the `abc` module here but do not use any of this functionality - it just serves as documentation.
Copy file name to clipboardExpand all lines: chapter04_factory/readme.md
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
**Simple Factory**: A class which chooses which product class to instantiate and return, based upon method parameters.
4
4
5
+
The Python standard library contains multiple references to factory objects, for instances in [dataclasses](https://docs.python.org/3/library/dataclasses.html?highlight=factory)
6
+
5
7
**Factory Method**: Defines an interface for creating an object, but lets subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses.
6
8
7
9
For instance the `PizzaStore` abstract class in this repo provides an abstract `create_pizza` interface for creating one product.
0 commit comments