RiskQuantLib.Property.property 源代码
#!/usr/bin/python
#coding = utf-8
#<import>
#</import>
[文档]class property(object):
"""
This is the basic class of any kind of attribute, except string. Any attribute
should have an effective date.
"""
#<init>
def __init__(self,value):
self.value = value
self.belongToObject = None
self.belongToAttrName = ''
#</init>
#<setBelongTo>
[文档] def setBelongTo(self,belongToObject,belongToAttrName:str):
self.belongToObject = belongToObject
self.belongToAttrName = belongToAttrName
#</setBelongTo>
#<commit>
[文档] def commit(self):
if getattr(self,'belongToObject',None) and getattr(self,'belongToAttrName','')!='':
setattr(self.belongToObject,self.belongToAttrName,self.value)
#</commit>
#<setValue>
#</setValue>
#<setEffectiveDate>
#</setEffectiveDate>
#<property>
#</property>