[Tutor] Walk a dictionary recursively

Alan Gauld alan.gauld at freenet.co.uk
Tue Oct 11 11:29:27 CEST 2005


> 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".

Its not uncommon but often it can be simplified by using classes.
In particular the classes can expose an interface that makes the 
structures appear simpler by providing the access mechanisms 
needed so that the outer code is ignorant of the structural complexity.

> to decode each contained element. Is there a way to walk recursively
> the dictionary, or should I write my own walk function?

Not for an arbitrarily complex structure such as you have defined. 
You will need to write your own I fear.

HTH

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list