Popular recipes by Yaniv Aknin http://code.activestate.com/recipes/users/4180246/2011-12-23T22:10:38-08:00ActiveState Code RecipesRecursively walk Python objects (Python)
2011-12-23T22:10:38-08:00Yaniv Akninhttp://code.activestate.com/recipes/users/4180246/http://code.activestate.com/recipes/577982-recursively-walk-python-objects/
<p style="color: grey">
Python
recipe 577982
by <a href="/recipes/users/4180246/">Yaniv Aknin</a>
(<a href="/recipes/tags/container/">container</a>, <a href="/recipes/tags/recursive/">recursive</a>, <a href="/recipes/tags/recursive_iterator/">recursive_iterator</a>, <a href="/recipes/tags/walk/">walk</a>).
Revision 2.
</p>
<p>A small function that walks over pretty much any Python object and yields the objects contained within (if any) along with the path to reach them. I wrote it and am using it to validate a deserialized data-structure, but you can probably use it for many things.</p>