0 votes
in Python by
What are Descriptors Properties?

1 Answer

0 votes
by
Descriptors can also be created using property() type.

It is easy to create a descriptor for any attribute using property().

Syntax of defining a Property

property(fget=None, fset=None, fdel=None, doc=None)

where,

fget : attribute get method

fset : attribute set method

fdel – attribute delete method

doc – docstring

Descriptors can also be created with property decorators.

While using property decorators, an attribute's get method will be same as its name and will be decorated with property.

In a case of defining any set or delete methods, they will be decorated with respective setter and deleter methods.

Related questions

0 votes
asked Oct 14, 2021 in Python by rajeshsharma
0 votes
asked Oct 11, 2021 in Python by rajeshsharma
...