Result of intersect() is a set, not a list
See original GitHub issuePer the API docs, intersect()
returns a list; however, in reality, it returns a set. This makes it impossible to store non-hashable types like dicts with insert()
.
I forked the repo and changed the set to a list, which otherwise works fine, but sometimes the list contains duplicates. I presume the set is intended as a way to work around this, but why is this happening and would it be possible to fix at the source?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Find elements NOT in the intersection of two lists
So I know how to find the intersection of two lists by doing: >>> a = [1,2,3,4,5] >>> b = [1,3,5,6] >>> list(set(a)...
Read more >Sets: union , intersect and setdiff - The R Book [Book] - O'Reilly
Make a mental note of what the two sets have in common, and what is unique to each. The union of two sets...
Read more >Intersection does not take list of lists
The function Intersection takes a number of lists (sets) and finds their intersection. However, the precise input is Intersection[{1, 1, 2, ...
Read more >Python Set intersection() Method - W3Schools
The intersection() method returns a set that contains the similarity between two or more sets. Meaning: The returned set contains only items that...
Read more >Taking an intersection of a list of sets - Appian Community
Simply, loop through every element of only one of the for sets. Reason; the mathematical law of set intersect states that every intersect...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Actually did a mistake, and once I corrected it now, there’s virtually no slowdown, from 0.010 to ca 0.015!
Fixed in new pypi release 1.0.0.