{"id":24878,"date":"2021-11-10T09:36:53","date_gmt":"2021-11-10T04:06:53","guid":{"rendered":"https:\/\/python-programs.com\/?p=24878"},"modified":"2021-11-10T09:36:53","modified_gmt":"2021-11-10T04:06:53","slug":"python-property-function-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-property-function-with-examples\/","title":{"rendered":"Python property() Function with Examples"},"content":{"rendered":"

property() Function in Python:<\/strong><\/p>\n

The property() construct returns the attribute of the property.<\/p>\n

Syntax:<\/strong><\/p>\n

property(fget=None, fset=None, fdel=None, doc=None)<\/pre>\n

Parameters<\/strong><\/p>\n

The property() function accepts four optional parameters:<\/p>\n

fget (Optional):<\/strong> Function for obtaining the value of an attribute. None is the default value.
\nfset (Optional):<\/strong> A function for setting the value of an attribute. None is the default value.
\nfdel (Optional):<\/strong> Deletes the attribute value. doc (optional) – A string containing the documentation (docstring) for the attribute. None is the default value.<\/p>\n

doc (Optional):<\/strong> A string containing the attribute’s documentation (docstring). None is the default value.<\/p>\n

Return Value:<\/strong><\/p>\n

property() function returns the property attribute based on the getter, setter, and deleter arguments.<\/p>\n