Re: Set operations on object attributes question

2007-10-23 Thread Raymond Hettinger
[Duane] > Since what I _really_ wanted from this was the intersection of the > objects (based on attribute 2), I was looking for a set-based > solution, > kinda like a decorate - - undecorate pattern. Perhaps > the problem does not fall into that category. Decorating and undecorating do not apply

Re: Set operations on object attributes question

2007-10-23 Thread Raymond Hettinger
> Since what I _really_ wanted from this was the intersection of the > objects (based on attribute 2), I was looking for a set-based > solution, > kinda like a decorate - - undecorate pattern. Perhaps > the problem does not fall into that category. The "kinda" part is where the idea falls down.

Re: Set operations on object attributes question

2007-10-23 Thread TheSeeker
Hi, Thanks for the response! (See below for more discussion) On Oct 23, 10:39 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Duane] > > > LoTuples1 = [(1,1,0),(1,2,1),(1,3,3)] > > Set1=set(LoTuples1) > > LoTuples2 = [(2,1,3),(2,2,4),(2,3,2)] > > Set2=set(LoTuples2) > > > What I would like to

Re: Set operations on object attributes question

2007-10-23 Thread Raymond Hettinger
[Duane] > LoTuples1 = [(1,1,0),(1,2,1),(1,3,3)] > Set1=set(LoTuples1) > LoTuples2 = [(2,1,3),(2,2,4),(2,3,2)] > Set2=set(LoTuples2) > > What I would like to be able to do is: > > Set3 = Set1union(Set2) > Set3.intersection(Set2, ) > > to return: > set([(2,1,3), (1,3,3)]) > > How can one do this oper

Re: Set operations on object attributes question

2007-10-23 Thread A.T.Hofkamp
On 2007-10-23, TheSeeker <[EMAIL PROTECTED]> wrote: > Hi, > > I have run into something I would like to do, but am not sure how to > code it up. I would like to perform 'set-like' operations (union, > intersection, etc) on a set of objects, but have the set operations > based on an attribute of the

Set operations on object attributes question

2007-10-23 Thread TheSeeker
Hi, I have run into something I would like to do, but am not sure how to code it up. I would like to perform 'set-like' operations (union, intersection, etc) on a set of objects, but have the set operations based on an attribute of the object, rather than the whole object. For instance, say I hav