Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On Aug 17, 2:29 am, Raymond Hettinger wrote: > I would like to see someone post a subclass to the ASPN Cookbook that > adds a number of interesting, though not common operations.  Your > symmetric_difference() method could be one.  A dot_product() operation > could be another.  Elementwise arithm

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On Aug 17, 10:47 pm, Paddy wrote: > On 17 Aug, 02:29, Raymond Hettinger wrote: > > > > > [Paddy] > > > > Lets say you have two *sets* of integers representing two near-copies > > > of some system, then a measure of their difference could be calculated > > > as: > > > > len(X.symmetric_difference(

Re: EXOR or symmetric difference for the Counter class

2010-08-17 Thread Paddy
On 17 Aug, 02:29, Raymond Hettinger wrote: > [Paddy] > > > Lets say you have two *sets* of integers representing two near-copies > > of some system, then a measure of their difference could be calculated > > as: > > > len(X.symmetric_difference(Y)) / (len(X) + len(Y)) * 100 % > > > If the two coll

Re: EXOR or symmetric difference for the Counter class

2010-08-16 Thread Raymond Hettinger
[Paddy] > Lets say you have two *sets* of integers representing two near-copies > of some system, then a measure of their difference could be calculated > as: > > len(X.symmetric_difference(Y)) / (len(X) + len(Y)) * 100 % > > If the two collections of integers are allowed duplicates then you > need

Re: EXOR or symmetric difference for the Counter class

2010-08-16 Thread Paddy
On 14 Aug, 18:14, Raymond Hettinger wrote: > On Aug 12, 1:20 pm, Paddy wrote: > > > I find myself needing to calculate the difference between two Counters > > or multisets or bags. > > > I want those items that are unique to each bag. > > Tell us about your use cases.  I'm curious how a program w

Re: EXOR or symmetric difference for the Counter class

2010-08-14 Thread Raymond Hettinger
On Aug 12, 1:20 pm, Paddy wrote: > I find myself needing to calculate the difference between two Counters > or multisets or bags. > > I want those items that are unique to each bag. Tell us about your use cases. I'm curious how a program would ascribe semantic meaning to the result. The phrase

Re: EXOR or symmetric difference for the Counter class

2010-08-13 Thread Paddy
On Aug 13, 6:36 am, Steven D'Aprano wrote: > On Thu, 12 Aug 2010 13:20:19 -0700, Paddy wrote: > > I find myself needing to calculate the difference between two Counters > > or multisets or bags. > > Is this collections.Counter from Python 3.1? If so, you should say so, > and if not, you should tel

Re: EXOR or symmetric difference for the Counter class

2010-08-12 Thread Chris Rebert
On Thu, Aug 12, 2010 at 10:36 PM, Steven D'Aprano wrote: > On Thu, 12 Aug 2010 13:20:19 -0700, Paddy wrote: > >> I find myself needing to calculate the difference between two Counters >> or multisets or bags. > > Is this collections.Counter from Python 3.1? "Changed in version **2.7**: Added Coun

Re: EXOR or symmetric difference for the Counter class

2010-08-12 Thread Steven D'Aprano
On Thu, 12 Aug 2010 13:20:19 -0700, Paddy wrote: > I find myself needing to calculate the difference between two Counters > or multisets or bags. Is this collections.Counter from Python 3.1? If so, you should say so, and if not, you should tell us which Counter class this is. It will save peopl