On 2016-10-01 12:27, saad khalid wrote:
That's about my idea right now. Do you have any tips or tricks to make
it faster? Are there any list comprehension tricks I'm missing? Thanks
in advance!
If you're interested in the number of sub-lists that have the first n
elements in common, sort the list and compare only nearby rows;
something like this:
mytaylors.sort()
matchcounter = [0] * 21
for j in xrange(len(mytaylors)):
for k in xrange(j+1,len(mytaylors)):
if mytaylors[j][0] != mytaylors[k][0]:
break
for n in xrange(1,20):
if mytaylors[j][n] == mytaylors[k][n]:
continue
matchcounter[n] += 1
break
else:
matchcounter[20] += 1
--
*\\* Anton Sherwood *\\* www.bendwavy.org
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.