Add note about calling super() in base class.
dblume

dblume commited on 2022-08-20 22:00:22
Showing 1 changed files, with 2 additions and 0 deletions.

... ...
@@ -37,6 +37,7 @@ def set_v_print(verbose: bool) -> None:
37 37
 class Coffee:
38 38
 
39 39
     def __init__(self, price: float):
40
+        super().__init__()  # See https://eugeneyan.com/writing/uncommon-python/
40 41
         self._price = price
41 42
 
42 43
     @property
... ...
@@ -74,6 +75,7 @@ def main(debug: bool) -> None:
74 75
 
75 76
     cuppa = Coffee(5.00)
76 77
     cuppa.price = cuppa.price - 1.00
78
+    print(f'Coffee on sale for ${cuppa.price:1.2f}.')
77 79
 
78 80
 
79 81
 if __name__ == '__main__':
80 82