<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<pre style="word-wrap:break-word; font-size:10.0pt; font-family:Tahoma; color:black">Reading the code for the first time.. It descends when searching. It can only find a match when never greater than or equal to one. If the descent doesn't find anything.. Then you return to the top level and have an error.
Dhananjay Balan <mb.dhananjay@gmail.com> wrote:
</pre>
<div>Hi,
<div><br>
</div>
<div>Need help with a code snippet. I cannot understand the need for "nesting" in the following.</div>
<div><br>
</div>
<div><br>
</div>
<blockquote type="cite">
<div>rtems.py line 33-47</div>
<div>def lookup_function (val):</div>
<div> "Look-up and return a pretty-printer that can print val."</div>
<div><br>
</div>
<div> global nesting</div>
<div><br>
</div>
<div> typename = str(type_from_value(val))</div>
<div><br>
</div>
<div> for function in pp_dict:</div>
<div> if function.search (typename):</div>
<div> nesting += 1</div>
<div> result = pp_dict[function] (val)</div>
<div> nesting -= 1</div>
<div> if nesting == 0:</div>
<div> objects.information.invalidate()</div>
<div> return result</div>
</blockquote>
<div><br>
</div>
<div>Thanks,</div>
<div>Dhananjay</div>
</div>
</body>
</html>