Hello, i have e little performance problem with my code...
i have to compare many lists of very much floats. at moment i have nested for-loops for a in range( len(lists) ): for b in range( a+1 , len(lists) ): for valuea in lists[a]: equal=False for valueb in lists[b]: if inTolerance( valuea , valueb , 1.0): # inTolerance is an own function, which checks if the difference of valuea and valueb is not more then 1.0% equal=True break if equal: print a , "and" , b , "are equal" i found a version with set which is faster, but i cannot assign an tolerance (%) for a in range( len(lists) ): for b in range( a+1 , len(lists) ): if len( lists[a] ) == len( set( lists[a] ).intersection( set( lists[b] ) ) ): print a , "and" , b , "are equal" have you an idea how i can change my code, that i can compare many lists of floats with a tolerance in percentage very fast? (sorry for my bad englisch ;-) ) thanks christian -- http://mail.python.org/mailman/listinfo/python-list