Howdy,
I'm playing around with property in Python and I was wondering how this @propertyName.deleter decorator works. I'm probably missing something, I could not find clear answers by Google.
What I would like to achieve is when this deleter behavior is called, I can trigger other actions (e.g: using my 3d application SDK).
For now just a simple print() doesn't seem to get triggered.
Is deleter fired when I delete the property using del(instance.property) ?
Otherwise, how can I achieve this?
class M():
def __init__(self):
self._m = None
@property
def mmm(self):
return self._m
@mmm.setter
def mmm(self, val):
self._m = val
@mmm.deleter
def mmm(self):
print('deleting') # Not printing
del(self._m)
if __name__ == '__main__':
i = M()
i.mmm = 150
print(i.mmm)
del(i.mmm)
print(i.mmm)
Thank you very much (: