Python getter method | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Python getter method

if i want to get an argument from a class i can simply define a function named sane as the argument with the @property decorator above, then what is the reason for using the getter decorator (@name.getter)?? thanks in advance

15th Dec 2018, 3:25 PM
Amine Tahiri
Amine Tahiri - avatar
1 Réponse
+ 1
A getter method is used to control future implemntations of the recieving of a field without breaking backwards conpatibility.
15th Dec 2018, 3:41 PM
Freetoast
Freetoast - avatar