What's the most efficient way of intersecting to collections in Python?
I'm new in python, sorry if there's anything wrong.
I'd like to intersect several collections (20 o 30) with a big amount of elements in them.
I've been reading and know that Sets are similar to hashtables (work with the same principle). Sets has the intersect method,开发者_JAVA技巧 i've been trying it and works really fine.
But, would like to have an experienced opinion.
What would you do?
The problem again. 20 or 30 collections (can be set, the elements are not repeated) and want to make intersection of them. Don't think how the collections are created (i.e. the insertion doesn't matters)
Thanks a lot!
result = set1.intersection(set2, set3, set4, ...)
http://docs.python.org/library/stdtypes.html
精彩评论