Mercurial > pylearn
comparison misc.py @ 71:5b699b31770a
merge
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Fri, 02 May 2008 18:19:35 -0400 |
parents | 718befdc8671 |
children | e9a95e19e6f8 |
comparison
equal
deleted
inserted
replaced
70:76e5c0f37165 | 71:5b699b31770a |
---|---|
1 | |
2 def unique_elements_list_intersection(list1,list2): | |
3 """ | |
4 Return the unique elements that are in both list1 and list2 | |
5 (repeated elements in listi will not be duplicated in the result). | |
6 This should run in O(n1+n2) where n1=|list1|, n2=|list2|. | |
7 """ | |
8 return list(set.intersection(set(list1),set(list2))) |