On Mon, Nov 23, 2009 at 11:14 AM, astral orange <span dir="ltr"><<a href="http://457r0.jp">457r0.jp</a>@<a href="http://gmail.com">gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div><div></div><div class="h5">But back to the example, on line 104 I see there's a call to the</div></div>
lookup function, passing 3<br>
parameters ('data', which I think is a nested dictionary, label<br>
(first, middle, last) and name).<br></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
But I am getting lost on line 111 after the parameters are passed in<br>
to the lookup function. I'm<br>
not exactly sure what it's returning</blockquote><div><br></div><div>The 'get' method of dictionaries returns either the value if it exists, or None.</div><div><br></div><div>So lookup is returning either a the value from that nested dictionary (the value which will be a list of names), or None.</div>

<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> and when it does return, is this<br>
assigned the the variable<br>
'people'?</blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> And if so, I'm not sure what 'append(full_name)' does here.<br>


The else statement which assigns<br>
'[full_name]' to 'data[label][name]' is somewhat confusing as I'm<br>
saying to myself where the heck did<br>
'[full_name]' come "into the picture".<br>
<br></blockquote><div><br></div><div>Look up at line 97.</div><div><br></div><div>The "purpose" of this code seems-- on a cursory glance-- to be to categorize peoples names into lists where their names are common.</div>

<div><br></div><div>The data dictionary contains three dictionaries; one for first names, one for middle names, one for last names. </div><div><br></div><div>Each dictionary would, over time, contain the name-part as a key and then a list of full names...</div>

<div><br></div><div>So, I'd be:</div><div><br></div><div>data['first']['Stephen'] = ['Stephen Hansen']</div><div>data['last']['Hansen'] = ['Stephen Hansen']</div><div><br>

</div><div>Then if Bob Hansen was run through the code, it'd end up as:</div><div><br></div><div>data['last']['Hansen'] = ['Stephen Hansen', 'Bob Hansen']</div><div><br></div><div>At least I think that's what the code is doing. Based upon just a stare. :) (And if that's what its doing, I think it has a bug as I mentioned in a previous email; I think lines 105-108 need to be indented one level more)</div>

<div><br></div><div>So, what all this code is doing is breaking apart someoen's full_name which was passed into the function originally, and seeing where to put it. That's what the for loop and lookup function calls are doing... seeing if we need a new list , or if there's an existing one to add the name to... When it decides where it goes, it puts the full_name in. </div>

<div> </div></div><br clear="all"><div name="mailplane_signature">--S</div>