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:
• Created 6 years ago
• Reactions:1

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.

#### 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)...
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...
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, ...
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...
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...

#### Troubleshoot Live Code

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