Having an issue with descriptors in Python. Are the __get__
and __set__
not supported?
Here is the code:
class tagger(object):
def __init__(self, tagPath):
self.tagPath = tagPath
def __get__(self, obj, objtype):
print("get")
return system.tag.read(self.tagPath).value
def __set__(self, obj, val):
print("set")
system.tag.write(self.tagPath, val)
def __str__(self):
return str(system.tag.read(self.tagPath).value)
class exeEngStepper(object):
def __init__(self, exeEngStepID):
self.exeStepID = exeEngStepID
self.completeC = tagger("[default]ExecutionStepList/exeEngStep" + str(self.exeStepID) + "/completeC")
tc = exeEngStepper(1)
type(tc.completeC)
print(tc.completeC)
tc.completeC
tc.completeC = 12
type(tc.completeC)
Here is the output:
<class '__main__.tagger'>
111
<__main__.tagger object at 0x15>
<type 'int'>