Property Methods
property.deleter()
Replace or supply the accessor used for deletion of a managed attribute. A deleter normally accepts the instance and performs the requested cleanup. The method returns a new property descriptor; the original is unchanged. Rebind it to the class attribute (or use the decorator form with the same attribute name). In local CPython 3.13.5, passing None retains the existing accessor; construct a new property explicitly with a missing accessor to omit it. Missing accessors cause AttributeError when the corresponding operation is attempted.
Formal Syntax & Structure
python syntaxpython
descriptor.deleter(fdel, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| fdel | Callable | None | Replacement accessor; None retains the existing accessor in CPython 3.13.5. |
Return Value
property
New descriptor with the selected accessor replaced.
Working Example
Example Snippetpython
def read(self): return self._valuedef write(self, value): self._value = valuedef erase(self): del self._valueoriginal = property(read, write, None)updated = original.deleter(erase)class Item: value = updateditem = Item()item._value = 4del item.valueprint(hasattr(item, "_value"))print(original.fdel is None, updated is original)