Re: How to iterate through two dicts efficiently

2011-07-19 Thread Chris Rebert
On Tue, Jul 19, 2011 at 7:20 AM, J wrote: > Hi guys, > > Thank you for your suggestions.  I have managed to get my whole script to > execute in under 10 seconds by changing the 'for loop' I posted above to the > following:- > > for opco in Cn: >        for service in Cn[opco]: >                a

Re: How to iterate through two dicts efficiently

2011-07-19 Thread J
Hi guys, Thank you for your suggestions. I have managed to get my whole script to execute in under 10 seconds by changing the 'for loop' I posted above to the following:- for opco in Cn: for service in Cn[opco]: ack = set(Cn[opco][service]['RECV']) & set(Pr['13'])

Re: How to iterate through two dicts efficiently

2011-07-19 Thread Dave Angel
On 01/-10/-28163 02:59 PM, J wrote: Hello, I am looking to improve the performance of the following piece of Python code:- for cc in StatusContainer: for srv in StatusContainer[cc]: for id in StatusContainer[cc][srv]['RECV']: if id in StageContain

Re: How to iterate through two dicts efficiently

2011-07-19 Thread Tim Chase
On 07/19/2011 04:36 AM, J wrote: Someone in a different forum suggested that I use 'binary search' to iterate through the dictionaries I'm not sure what they were smoking...a binary search is useful for finding a thing in a sorted list. It looks like your data is not sorted (strike #1) and i

Re: How to iterate through two dicts efficiently

2011-07-19 Thread Peter Otten
J wrote: > I am looking to improve the performance of the following piece of Python > code:- > > for cc in StatusContainer: > for srv in StatusContainer[cc]: > for id in StatusContainer[cc][srv]['RECV']: > if id in StageContainer['13']: > StatusContainer[c

How to iterate through two dicts efficiently

2011-07-19 Thread J
Hello, I am looking to improve the performance of the following piece of Python code:- for cc in StatusContainer: for srv in StatusContainer[cc]: for id in StatusContainer[cc][srv]['RECV']: if id in StageContainer['13']: