I have a list of sets:

```
setlist = [s1,s2,s3...]
```

I want s1 ∩ s2 ∩ s3 ...

I can write a function to do it by performing a series of pairwise `s1.intersection(s2)`

, etc.

Is there a recommended, better, or built-in way?

From Python version 2.6 on you can use multiple arguments to `set.intersection()`

, like

```
u = set.intersection(s1, s2, s3)
```

If the sets are in a list, this translates to:

```
u = set.intersection(*setlist)
```

where `*a_list`

is list expansion

As of 2.6, `set.intersection`

takes arbitrarily many iterables.

```
>>> s1 = set([1, 2, 3])
>>> s2 = set([2, 3, 4])
>>> s3 = set([2, 4, 6])
>>> s1 & s2 & s3
set([2])
>>> s1.intersection(s2, s3)
set([2])
>>> sets = [s1, s2, s3]
>>> set.intersection(*sets)
set([2])
```

Licensed under: CC-BY-SA with attribution

Not affiliated with: Stack Overflow