comparing values in two sets
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Sun May 14 19:29:09 EDT 2006
Note that you are comparing ordered sequences, like lists, tuples,
strings, etc, and not sets. Something like this can be a little
improvement of your code, it avoids building the zipped list, and scans
the iterable unpacking it on the fly:
from itertools import izip
def test_sets(original_set, trans_letters):
for elem1, elem2 in izip(original_set, trans_letters):
if elem1 == elem2:
return False
return True
Bye,
bearophile
More information about the Python-list
mailing list