Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # demo_descriptors.py
- def _get(self, obj, obj_type): print('%s:__get__()' % type(self).__name__)
- def _set(self, obj, val): print('%s:__set__()' % type(self).__name__)
- def _delete(self, obj): print('%s:__delete__()' % type(self).__name__)
- class SetGetDataDescriptor:
- __get__ = _get
- __set__ = _set
- class DeleteGetDataDescriptor:
- __get__ = _get
- __delete__ = _delete
- class SetOnlyDataDescriptor:
- __set__ = _set
- class DeleteOnlyDataDescriptor:
- __delete__ = _delete
- class NonDataDescriptor:
- __get__ = _get
Add Comment
Please, Sign In to add comment