From c3eddb90112e85ca0bc6894751ca73949f6cdc3b Mon Sep 17 00:00:00 2001 From: Rogier Krieger Date: Fri, 1 Dec 2023 21:40:52 +0100 Subject: [PATCH] Fix variable name for comparison object in cheaper() example. This renames the variable name for the comparison object and adds type hinting for the Person.cheaper() method in part 10.3. Currently, the material uses a variable 'Person' as the comparison object for cheaper(), which is confusing. --- data/part-10/3-oo-programming-techniques.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/part-10/3-oo-programming-techniques.md b/data/part-10/3-oo-programming-techniques.md index 1c09debee..b5a095d4a 100644 --- a/data/part-10/3-oo-programming-techniques.md +++ b/data/part-10/3-oo-programming-techniques.md @@ -59,11 +59,11 @@ class Product: def price(self): return self.__price - def cheaper(self, Product): - if self.__price < Product.price: + def cheaper(self, other: Product) -> Product: + if self.__price < other.price: return self else: - return Product + return other ``` ```python