fix(curriculum): add brief explanation for decorators in getters and setters lesson (#65888)

Co-authored-by: Dario <105294544+Dario-DC@users.noreply.github.com>
This commit is contained in:
Aditya Singh
2026-03-07 15:49:08 +05:30
committed by GitHub
parent 48e86c5399
commit c95d4a87e0
@@ -21,7 +21,9 @@ When you use a method, you always have to call it with parentheses. But with a p
For example, you might want to calculate a value or check that a new value is valid before saving it. Instead of calling a method for that, you can use an attribute-like way to do that.
To create a property, you define a method and place the `@property` decorator above it. This tells Python to treat the method as a property.
In Python, a decorator is a function that modifies the functionalities of other functions, or classes, without changing their original code.
While it is possible to create custom decorators, this is beyond the scope of this lesson. Just know that to create a property, you define a method and place the `@property` decorator above it. This turns the method into a property, so it can be accessed like an attribute while internally calling the decorated method.
That takes us to getters. Here's how to create one with the `@property` decorator: