Python - recursion not working
<p>I have a following code:</p>

<pre><code>d = {'init':
       [{'solve':
                 [{'subsolve':
                       [{'vals': [{'Blade summary': 'asdf'},
                                  {'Blade summary': 'fdsa'}]}]},
                  {'subsolve':
                       [{'vals': [{'Blade summary': 'ffff'}]}]}]},
        {'solve':
                 [{'subsolve':
                       [{'vals': 'bbbb'}]}]}]}

def parseDics(lst, mainReg):
    print('call')
    for dic in lst:
        for key, vals in dic.items():
            if key == mainReg:
                if mainReg == 'vals':
                    yield vals
                parseDics(vals, 'vals')
            else:
                parseDics(vals, mainReg)



if __name__=='__main__':
    pp.pprint(list(parseDics(d['init'], 'solve')))
</code></pre>

<p>The function itself is not complete, but that's not a problem for now. The problem is, it appears, that recursive calls don't work.</p>

<p>If I try to run it now, I'll get only this output:</p>

<pre><code>call
[]
</code></pre>

<p>So the function was called only once. When I try to step into the nested function call (I'm using PyCharm), then I'm simply not not able to and the function call is "over-stepped".</p>

<p>What am I doing wrong? Why isn't my function called recursively?</p>

<p>In Python 3.4 you can use <code>yield from parseDics(vals, 'vals')</code>, for Python 2:</p>

<pre><code>for val in parseDics(vals, 'vals'):
    yield val
</code></pre>

python python-3.x dictionary recursion pycharm