[perl-python] generic equivalence partition

David Eppstein eppstein at ics.uci.edu
Fri Feb 25 00:29:12 EST 2005


In article <eppstein-CDFABC.20594724022005 at news.service.uci.edu>,
 David Eppstein <eppstein at ics.uci.edu> wrote:

> def parti(aList,equalFunc):
>     eqv = []
>     for i in range(len(aList)):
>         print i,eqv
>         for L in eqv:
>             if equalFunc(aList[i],aList[L[0]]):
>                 L.append(i)
>                 break;
>         else:
>             eqv.append([i])

Um, take out the print, that was just there for me to debug my code.

-- 
David Eppstein
Computer Science Dept., Univ. of California, Irvine
http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list