Created
August 20, 2025 18:30
-
-
Save hoosnick/4a67ada9a454545045419a0abba330ca to your computer and use it in GitHub Desktop.
Code from Telegraph article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import final | |
| class Report: | |
| def generate_header(self): | |
| return "--- Company Header ---" | |
| @final | |
| def build_report(self) -> str: | |
| # Бу методнинг логикаси ўзгармас бўлиши керак | |
| header = self.generate_header() | |
| body = "This is the main content." | |
| return f"{header}\n{body}" | |
| class FinancialReport(Report): | |
| # Оддий методни қайта ёзиш мумкин | |
| def generate_header(self): | |
| return "--- Financial Report Header ---" | |
| # @final методни қайта ёзишга уриниш | |
| def build_report(self) -> str: # <-- MyPy хато беради! | |
| return "Oops, I broke the logic." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment