Python iterations
<p>Has anybody any idea why this code fails to run smooth? It seems not to like iterations with the yield keyword:
I am trying to mine all the numbers from any level of lists or dicts ( especially interested in lists ).
At the second iteration it finds [2,3] but fails to print 2 and 3 one after other...Imagine also that I could have many levels of lists.</p>

<pre><code>def digIn( x ):
    try:
        if isDict(x) or isList(x):
            print "X:", x
            for each in x:
                print "each:", each
                if isDict(each) or isList(each):
                    digIn(each)
                else:
                    yield each
        else:
            yield x
    except Exception,ex:
        print ex

print "STARTING OVER"
for i in digIn( [1,[2,3]] ):
    print i
</code></pre>
