Apologies if this is te wrong place to post - I realise the question is pretty basic...
I have a simple python script that parses a text file and extracts data from it. Currently this data is stored in a list by a function, each element of which is an instance of a class with member variables to take the data. So for example I have: camera_list.append(camera(alpha,beta,gamma....)) where class camera: def __init__(self,name,site,address,text): self.name=name self.site=site self.address=address self.text=text Every time I append an item to this list I pass in the constructor parameters so end up with all my data in the list which can then be accessed by doing myList[x].name (for example) This seemed like a nice solution until I tried to put the entire parsing program into its own class. I did this so that I could parse different types of file: thistype.getdata() thattype.getdata() ... thisfile and thatfile would have the same function definitions, but different implementations as needed. But now my list generating funtion needs to create inner "camera" classes when it is itself a member funcition of a class. This seems to be causing problems - I coudl possibly use nested dictionaries, but this sounds messy. Ideally I would use structs defined inside the outer class, but pythn doesn't seem to support these. I hope I haven't rambled too much here - I'm new to python so have probably done some silly things :-) Cheers, Ben -- http://mail.python.org/mailman/listinfo/python-list