<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 5, 2013 at 10:34 PM, inshu chauhan <span dir="ltr"><<a href="mailto:insideshoes@gmail.com" target="_blank">insideshoes@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hello everyone, <div><br></div><div>Here in my part of the code where cc is a dictionary. I want to understand what actually cc.iterkeys() and cc[k] actually doing. </div>
<div>I am already reading <a href="http://docs.python.org/2/library/stdtypes.html#dict.items" target="_blank">http://docs.python.org/2/library/stdtypes.html#dict.items</a></div>
<div>and <a href="http://www.tutorialspoint.com/python/python_dictionary.htm" target="_blank">http://www.tutorialspoint.com/python/python_dictionary.htm</a> but still not very clear. </div><div><br></div><div>cc = Computesegclass(segimage, refimage) </div>

<div>    for k in sorted(cc.iterkeys()):</div><div>        i = argmax(cc[k])</div><div>        print >> f, i+1</div><div><br></div></div></blockquote><div><div class="gmail_quote" style="font-family:arial,sans-serif;font-size:13px">
<div><br></div><div>Not sure what Computesegclass is but i am guessing that it is a class which implements __getitem__ and __setitem__, which allows the use of the square bracket notation cc[k], you could also write cc.__getitem__(k) , if you really wanted to. </div>
<div>See <a href="http://docs.python.org/2/reference/datamodel.html#object.__getitem__" target="_blank">http://docs.python.org/2/reference/datamodel.html#object.__getitem__</a></div><div><br></div></div><div class="gmail_extra" style="font-family:arial,sans-serif;font-size:13px">
iterkeys returns an iterator over the dictionary keys, which is an object with a next method which returns each key in the dictionary until there are no more, then it raises StopIteration.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div></div><div>Thanks in Advance </div><div> </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>"The UNIX system has a command, nice ... in order to be nice to the other users. Nobody ever uses it." - Andrew S. Tanenbaum</div>
</div></div>