Firstly are you using this to store or alter data regarding Microsoft Active Directory?. If so I suggest you look at some of their ADSI / WMI interfaces for COM (if you use win32com from Mark Hammond or activeState life becomes a lot easier. Well the Windows programming part of it does)
As for the particulars of your question, you might find life simpler if you created a "parentID" (and/or childID) for each unique entry in the tree. As you are going to be growing the data list in size one other area to look at is generators - this will enable you to walk arbitrarily large trees but with a far lower memory footprint and hence a lot faster. A generator class returns an object that will walk through an iteration set (like a for loop) but at the end of every step will "disappear" from the stack and when it is called again it starts exactly where it left off. So I would suggest you create generaotr based classes to store your data, using an explicit parent/child relationship rather than relying on the implicit relationships of which dictionary is stored inside which dictionary. It is still a far chunk of work. I suggest you start on the parent child thing first. Think about having a single point of entry that creates a new object and then "hangs" it on the tree. I hope that helps and do please come back to the list with how you are gettng on. On 10/11/05, Negroup - <[EMAIL PROTECTED]> wrote: > Hi tutors, in my application I found convenient to store all the data > in a data structure based on a dictionary containing a lot of keys, > and each of them host other dictionary with lists and dictionaries > nested inside and so on... > > First of all I'd like to know if it is normal to use so complex data > structures in which store data, or if it possible in some way to > organize them using smaller "organizational units". > > This is instead the problem I should solve as soon as possible: I > should apply a function, exactly the string's method decode('utf-8'), > to each key and value of the above descripted dictionary. Consider > that the keys are integers or strings, and if a key is a list, I need > to decode each contained element. Is there a way to walk recursively > the dictionary, or should I write my own walk function? > > Thanks in advance, > negroup > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- -------------------------- Paul Brian m. 07875 074 534 t. 0208 352 1741 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor