all Python 3Sets (set)function
set.intersection_update
set theory
Keep only elements found in all the others (in-place intersection).
Syntax
s.intersection_update(*others)
It shrinks the set in place and returns None, so chaining the call or assigning its result is a mistake. Every name bound to that same set sees the trimmed version; if you still need the original contents, use intersection() and store the result in a new variable.
Examples
s = {1, 2, 3, 4}
s.intersection_update({2, 3, 5})
print(sorted(s)) # → [2, 3]
See also
Open in the full glossarydocs.python.orgReport an inaccuracy