RE: Dict Copy & Compare

2007-05-01 Thread Steven D'Aprano
On Tue, 01 May 2007 08:14:53 -0500, Hamilton, William wrote: >> -Original Message- >> From: Steven D'Aprano >> Sent: Monday, April 30, 2007 10:14 PM >> To: python-list@python.org >> Subject: RE: Dict Copy & Compare >> >> On Mon, 3

RE: Dict Copy & Compare

2007-05-01 Thread Hamilton, William
> -Original Message- > From: Steven D'Aprano > Sent: Monday, April 30, 2007 10:14 PM > To: python-list@python.org > Subject: RE: Dict Copy & Compare > > On Mon, 30 Apr 2007 12:50:58 -0500, Hamilton, William wrote: > > >> On quick question, h

RE: Dict Copy & Compare

2007-04-30 Thread Steven D'Aprano
On Mon, 30 Apr 2007 12:50:58 -0500, Hamilton, William wrote: >> On quick question, how can I order a dict by the 'values' (not keys) >> before >> looping? Is that possible? >> > > The easiest way I can think of is to create a new dict that's reversed. > > reverseDict = {} > for key in dict1: >

RE: Dict Copy & Compare

2007-04-30 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Robert Rawlins - > Think Blue > Sent: Monday, April 30, 2007 6:09 AM > To: 'Tim Golden' > Cc: python-list@python.org > Subject: RE: Dict Copy & Compare >

RE: Dict Copy & Compare

2007-04-30 Thread Robert Rawlins - Think Blue
1 over and done with :-D Thanks, Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Golden Sent: 30 April 2007 12:54 Cc: python-list@python.org Subject: Re: Dict Copy & Compare Robert Rawlins - Think Blue wrote: > On[e] quick question, how ca

Re: Dict Copy & Compare

2007-04-30 Thread Tim Golden
Robert Rawlins - Think Blue wrote: > On[e] quick question, how can I order a dict by > the 'values' (not keys) before looping? Is that possible? Depends on what you want to do. You can loop on the sorted values very easily: d1 = dict (a=2, b=1) for value in sorted (d1.values): print value

RE: Dict Copy & Compare

2007-04-30 Thread Robert Rawlins - Think Blue
om: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Golden Sent: 30 April 2007 11:27 Cc: python-list@python.org Subject: Re: Dict Copy & Compare Robert Rawlins - Think Blue wrote: > Hello Tim, > > Sorry, that 'value' was a slip up on my part, we're just

Re: Dict Copy & Compare

2007-04-30 Thread Tim Golden
Robert Rawlins - Think Blue wrote: > Hello Tim, > > Sorry, that 'value' was a slip up on my part, we're just dealing with keys > here. > > I get that a dict stores unique keys only but we're comparing the two dicts, > so when I say 'unique keys in dict 1' I basically mean all those keys that > ar

RE: Dict Copy & Compare

2007-04-30 Thread Steven D'Aprano
On Mon, 30 Apr 2007 10:05:40 +0100, Robert Rawlins - Think Blue wrote: > I have two dicts, one named 'this' and the other named 'that'. > > I want to get all the unique keys from 'this' and log them into a file, I > then want to take all the unique values from 'that' and log them into a > separat

RE: Dict Copy & Compare

2007-04-30 Thread Robert Rawlins - Think Blue
ssage- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Golden Sent: 30 April 2007 10:15 Cc: python-list@python.org Subject: Re: Dict Copy & Compare Robert Rawlins - Think Blue wrote: > I have two dicts, one named 'this' and the other named 'that'. &

Re: Dict Copy & Compare

2007-04-30 Thread Steven D'Aprano
On Mon, 30 Apr 2007 09:40:53 +0100, Tim Golden wrote: > Robert Rawlins - Think Blue wrote: >> I'm looking for a little advice on dicts, firstly I need to learn how to >> copy a dict, I suppose I could just something like. > >> Self.newdict = self.olddict > >> But I fear that this only creates a

Re: Dict Copy & Compare

2007-04-30 Thread Tim Golden
Robert Rawlins - Think Blue wrote: > I have two dicts, one named 'this' and the other named 'that'. > > I want to get all the unique keys from 'this' and log them into a file, I > then want to take all the unique values from 'that' and log them into a > separate file. Couple of points which are c

RE: Dict Copy & Compare

2007-04-30 Thread Robert Rawlins - Think Blue
7;s just a case of firstly returning a list of all keys that are in 'this' but NOT in 'that' and then visa versa, then loop over them performing the function. Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Golden Sent: 30 A

Re: Dict Copy & Compare

2007-04-30 Thread Tim Golden
Robert Rawlins - Think Blue wrote: > I'm looking for a little advice on dicts, firstly I need to learn how to > copy a dict, I suppose I could just something like. > Self.newdict = self.olddict > But I fear that this only creates a reference rather than an actual copy, > this means that as soon a