| Jeff Abrahamson on 25 Feb 2007 20:17:41 -0000 |
|
Here's a python code snippet. The bit to note is that I have two
iterables of tuples, S and T. I expect S to have length 400 and T to
have length less than 20. Then I make sets sS and sT so that I can
construct the difference between them, sSmT.
print 'SFAP-1: len(S) =', len(S), ' len(T) =', len(T)
S_ref_pt = self.selector(S)
min_dist = 0
min_q = None
print 'SFAP-1: len(S) =', len(S), ' len(T) =', len(T)
sS = set([tuple(x) for x in S])
#sT = set([tuple(x) for x in T])
sT = set([tuple(y) for y in T])
print 'SFAP-1: len(S) =', len(S), ' len(T) =', len(T)
print 'SFAP-2: len(sS) =', len(sS), ' len(sT) =', len(sT)
sSmT = sS - sT
print 'len(sSmT)', len(sSmT)
assert(len(sSmT) > 0)
Here's a snippet from the log of running a program through this code
fragment. The thing to note is that sT keeps growing. But the
function in question returns and is recalled between blocks. So why
does sT grow? I think sT should have length no longer than T.
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 19
len(sSmT) 381
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 20
len(sSmT) 380
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 21
len(sSmT) 379
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 22
len(sSmT) 378
...
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 397
len(sSmT) 3
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 398
len(sSmT) 2
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 399
len(sSmT) 1
len(S) = 400 len(V) = 19 m = 20
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-1: len(S) = 400 len(T) = 19
SFAP-2: len(sS) = 400 len(sT) = 400
len(sSmT) 0
--
Jeff
Jeff Abrahamson <http://jeff.purple.com/> +1 215/837-2287
GPG fingerprint: 1A1A BA95 D082 A558 A276 63C6 16BF 8C4C 0D1D AE4B
Attachment:
signature.asc ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|