Discussion:
concept of creating structures in python
navneet khanna
2008-12-12 05:52:45 UTC
Permalink
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

Loading...