Re: concept of creating structures in python

2008-12-12 Thread Steven D'Aprano
On Fri, 12 Dec 2008 09:07:21 -0700, Joe Strout wrote: >> Joe missed a piece out here. If you change the signature of your >> D.__init__() to read >> >> def __init__(self, dataName='ND', index = 0, ele_obj=None): >> >> then you need to insert the following code at the top of the method: >> >>

Re: concept of creating structures in python

2008-12-12 Thread Steve Holden
Joe Strout wrote: > On Dec 12, 2008, at 9:00 AM, Steve Holden wrote: > >>> Change the default value of ds_obj here to None. Otherwise, you will >>> certainly confuse yourself (there would be just one default object >>> shared among all instances). >>> >> Joe missed a piece out here. If you change

Re: concept of creating structures in python

2008-12-12 Thread Joe Strout
On Dec 12, 2008, at 9:00 AM, Steve Holden wrote: Change the default value of ds_obj here to None. Otherwise, you will certainly confuse yourself (there would be just one default object shared among all instances). Joe missed a piece out here. If you change the signature of your D.__init__() t

Re: concept of creating structures in python

2008-12-12 Thread Steve Holden
Joe Strout wrote: > On Dec 11, 2008, at 10:52 PM, navneet khanna wrote: > >> 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'

Re: concept of creating structures in python

2008-12-12 Thread Joe Strout
On Dec 11, 2008, at 10:52 PM, navneet khanna wrote: 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()): Change the defa

concept of creating structures in python

2008-12-11 Thread navneet khanna
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