question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Result of intersect() is a set, not a list

See original GitHub issue

Per 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
karimbahgatcommented, Sep 13, 2018

Actually did a mistake, and once I corrected it now, there’s virtually no slowdown, from 0.010 to ca 0.015!

0reactions
karimbahgatcommented, Sep 14, 2018

Fixed in new pypi release 1.0.0.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found