fix(curriculum): include an example of a decorator (#58753)

Co-authored-by: Dario-DC <105294544+Dario-DC@users.noreply.github.com>
This commit is contained in:
Supravisor 2025-02-14 12:18:07 +13:00 committed by GitHub
parent a03317a702
commit 250d693e12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,6 +9,14 @@ dashedName: step-7
In order to be recognized as an abstract method, a method should be decorated with the `@abstractmethod` decorator.
A <dfn>decorator</dfn> is used in Python to modify the behavior of a function. Here's an example of how to use a decorator named `spam`:
```py
@spam
def foo():
pass
```
Modify your import statement to import the `abstractmethod` decorator and decorate both the `solve` and `analyze` methods of the `Equation` class. This will raise two exceptions.
Once a class inheriting from `ABC` has an abstract method, the class cannot be instantiated anymore. Therefore, delete the `Equation` instance to get rid of the error.