Re: [Tutor] Use iterator to refer to an object's attribute?

2006-04-21 Thread Ron Britton
Alan Thanks for the thorough reply. Hi Ron, I'm confused and may be missing something but it sounds to me like a classic tree structure that you are trying to build for each module. It seems like a tree to me. I''m not sure why you put filling the database into a separate function rather

Re: [Tutor] Use iterator to refer to an object's attribute?

2006-04-20 Thread Kent Johnson
Ron Britton wrote: Short version: How do I use an iterator to refer to an object's attribute? E.g., z is a list of attributes of b: for x, y in z: for a in b.x.y getattr(b, 'foo') is the same as b.foo. getattr takes a string for the name of the attribute. So you would need

Re: [Tutor] Use iterator to refer to an object's attribute?

2006-04-20 Thread Alan Gauld
Dictionaries are only pairs of data. I assume a list can be one of those elements, but I couldn't figure out how to make it work in the structure I presented. Yes, the object that is stored can be anything. Thus numList = [1,2,3] chrList = ['1','2','3'] numDict = {} numDict['asNum'] =

Re: [Tutor] Use iterator to refer to an object's attribute?

2006-04-20 Thread Ron Britton
I wanted to make the methods flexible enough that I wouldn't have to edit every method if the module list ever changed. I guess I don't understand how a dictionary works in this situation. I don;t understand what you don;t understand here. Can you expand on why you don't think a