Answers for "python attributes decorator"

0

python property decorator

@property decorator is a built-in decorator in Python which is helpful in defining the properties effortlessly without manually calling the inbuilt function property(). Which is used to return the property attributes of a class from the stated getter, setter and deleter as parameters.
class Student:

    def __init__(self, name):
        self.__name = name

    @property
    def name(self):
        return self.__name
Posted by: Guest on April-20-2021

Browse Popular Code Answers by Language