Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #42936 > unrolled thread

Re: Trying to understand working with dicts

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2013-04-06 15:20 -0400
Last post2013-04-06 15:20 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Trying to understand working with dicts Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-04-06 15:20 -0400

#42936 — Re: Trying to understand working with dicts

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2013-04-06 15:20 -0400
SubjectRe: Trying to understand working with dicts
Message-ID<mailman.205.1365276052.3114.python-list@python.org>
On Fri, 5 Apr 2013 18:04:03 +0530, inshu chauhan <insideshoes@gmail.com>
declaimed the following in gmane.comp.python.general:

> Hello everyone,
> 
> 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.
> I am already reading
> http://docs.python.org/2/library/stdtypes.html#dict.items
> and http://www.tutorialspoint.com/python/python_dictionary.htm but still
> not very clear.
> 
> cc = Computesegclass(segimage, refimage)
>     for k in sorted(cc.iterkeys()):

	Off hand, .iterkeys() is not doing much useful here. Most all
"iterator" systems are designed to generate/fetch the next entry WHEN
NEEDED. But you are passing it to a sort routine, and I don't know of
any lazy sort algorithm that can return the next /sorted/ item without
having processed all the items -- so that is effectively the same as 
sorted(cc.keys())



-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web