Property Attributes

property.fget

Stored read accessor; ordinary instance attribute access calls it with the instance. Reading this field on the property descriptor gives the original accessor object, or None if absent. It does not execute the accessor. Access a descriptor through its class (for example, Item.value) rather than through an instance, which normally invokes the getter. The field itself is read-only; use the corresponding replacement method to make a new property.

Formal Syntax & Structure

python syntaxpython
value.fget

Return Value

Callable | None

Stored accessor or None.

Working Example

Example Snippetpython
def read(self): return self._valuedef write(self, value): self._value = valuedef erase(self): del self._valuep = property(read, write, erase)print(p.fget is read)print(property().fget is None)print(p.fget.__name__)
Python Reference