Loop through multiple dicionaries and get name of dict in which value is
<p>I want to loop through multiple dictionaries to find a value residing in it. If the value is found, I want values and THE NAME of the dict returned. I have written a funtion to do it but i cannot extract the name only the complete dict. Here is the code:</p>

<pre><code>a = {1: ((1,1),999), 2: ((2,2),998), 3:((3,3),998)}
b = {1: ((4,4),997), 5:((5,5),996)}

def retOBJECT(tup):
    for l in [a,b]:
        for v in l:
            if tup in l[v]:
                return l,v,l[v][1]

print retOBJECT((1,1))

&gt;&gt;&gt; 
({1: ((1, 1), 999), 2: ((2, 2), 998), 3: ((3, 3), 998)}, 1, 999)
</code></pre>

<p>I do not want the whole dictionary returned but only its name so I know where the other values come from, i.e. the last two numbers. </p>

<p>And this is how I want it to look like: </p>

<pre><code>&gt;&gt;&gt; ('a', 1, 999)
</code></pre>

<p>Can anyone help here. I have always found excellent advice here and I am looking forward to some genius pointing out how to retrieve the name of a dictionary.</p>

<p>Many thanks in advance....</p>
