Re: Finding a tuple in a tuple

2007-02-23 Thread Duncan Booth
Philipp Pagel <[EMAIL PROTECTED]> wrote: > Another way to go instead of using sets, although probably less elegant: > True in [x in t1 for x in t2] > True True in [x in t1 for x in t3] > True True in [x in t1 for x in t4] > False True in [x in t1 for x in t5] > False Slightly

Re: Finding a tuple in a tuple

2007-02-22 Thread Jussi Salmela
[EMAIL PROTECTED] kirjoitti: > Hi, > > Lists say I have the following tuple - > > t1 = ("ONE","THREE","SIX") > > and then the following tuples - > > t2 = ("ONE","TWO","THREE") > > t3 = ("TWO","FOUR","FIVE","SIX") > > t4 = ("TWO",) > > t5 = ("TWO","FIVE") > > What I want to do is return true

Re: Finding a tuple in a tuple

2007-02-22 Thread Philipp Pagel
[EMAIL PROTECTED] wrote: > t1 = ("ONE","THREE","SIX") > t2 = ("ONE","TWO","THREE") > t3 = ("TWO","FOUR","FIVE","SIX") > t4 = ("TWO",) > t5 = ("TWO","FIVE") > What I want to do is return true if any member of tuple t1 is found in > the remaining tuples. Another way to go instead of using sets, al

Re: Finding a tuple in a tuple

2007-02-22 Thread Paul Rubin
"Paul McGuire" <[EMAIL PROTECTED]> writes: > A step further: use union to make a superset of t2-tN, then use & on > this superset. > > setlist = [t2,t3,t4,t5] > superset = reduce(set.union, map(set,setlist) ) > print bool(t1 & superset) Well you do have to convert them to sets. Also I thought ea

Re: Finding a tuple in a tuple

2007-02-22 Thread Paul McGuire
On Feb 22, 3:05 am, Paul Rubin wrote: > [EMAIL PROTECTED] writes: > > Lists say I have the following tuple - > > t1 = ("ONE","THREE","SIX") > > t2 = ("ONE","TWO","THREE") > > t3 = ("TWO","FOUR","FIVE","SIX") > > t4 = ("TWO",) > > t5 = ("TWO","FIVE") > > > What I want to d

Re: Finding a tuple in a tuple

2007-02-22 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Lists say I have the following tuple - > t1 = ("ONE","THREE","SIX") > t2 = ("ONE","TWO","THREE") > t3 = ("TWO","FOUR","FIVE","SIX") > t4 = ("TWO",) > t5 = ("TWO","FIVE") > > What I want to do is return true if any member of tuple t1 is found in > the remaining tuples.

Finding a tuple in a tuple

2007-02-22 Thread bg_ie
Hi, Lists say I have the following tuple - t1 = ("ONE","THREE","SIX") and then the following tuples - t2 = ("ONE","TWO","THREE") t3 = ("TWO","FOUR","FIVE","SIX") t4 = ("TWO",) t5 = ("TWO","FIVE") What I want to do is return true if any member of tuple t1 is found in the remaining tuples. T