Skip to content

Instantly share code, notes, and snippets.

@is55555
is55555 / descriptorExample.py
Last active Feb 20, 2017
basic example outlining how to use descriptors
View descriptorExample.py
# ***** "raw" descriptor not using "property" or property decorators.
class Descriptor(object): # simply encapsulates the management of the attribute "_name"
def __init__(self):
self._name = ''
def __get__(self, instance, owner):
print "Getting: %s" % self._name
return self._name
def __set__(self, instance, name):
You can’t perform that action at this time.