serhii.net

In the middle of the desert you can say anything you want

20 Jul 2022

Python set operations

Python sets have two kinds of methods:

  • a.intersection(b) which returns the intersection
  • a.intersection_update(b) which updates a by removing elements not found in b.

It calls the function-like ones (that return the result) operators, as opposed to the ‘update_’ ones.

(Built-in Types — Python 3.10.5 documentation)

Nel mezzo del deserto posso dire tutto quello che voglio.