how to create nested classes dynamically
gopal mishra
gopalm at infotechsw.com
Wed Nov 4 00:04:11 EST 2009
I have class structure as below. How can I create the following nested class
and its properties dynamically.
class AA(object):
class BB(object):
def setBB1(self, value):
##some code
def getBB1(self):
bb1 = #somecode
return bb1
bb1 = property(getBB1, setBB1, None, None)
bb2 = ...
bb = BB()
class CC(object):
....
cc = CC()
aa = AA()
print aa.bb.bb1
aa.bb.bb2 = '10'
print aa.bb.bb2
I want to achive dot structure get or set value.i.e. aa.bb.bb1
Thanks,
Gopal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091104/b6a270cd/attachment.html>
More information about the Python-list
mailing list