concept of creating structures in python

navneet khanna honey33145 at gmail.com
Fri Dec 12 06:52:45 CET 2008


Hello Everybody

I want to create a structure within a structure i.e. nested structures in
python.
I tried with everything but its not working.
my code is like this:

class L(Structure):

    def __init__(self,Name='ND',Addr=0,ds_obj = D()):

        self.Name = Name
        self.Addr = Addr
        self.ds_obj = ds_obj


class D(Structure):

    def  __init__(self,dataName='ND',index = 0,ele_obj=E()):

        self.dataName = dataName
        self.index = index
        self.ele_obj = ele_obj


these are two structures. I want to refer D structure in L one and use it. I
want to access the value of D structure like L.D.index = 0.

Please help me

Thanks in advance
Navneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081212/8b1f6d9d/attachment.html>


More information about the Python-list mailing list