Ezio Melotti added the comment:
This doesn't modify f, it replaces it with a new frozenset:
>>> f = frozenset({1, 2})
>>> f
frozenset({1, 2})
>>> id(f)
3071990668
>>> f -= frozenset({1})
>>> f
frozenset({2})
>>> id(f)
3066719340
Notice how the two ids are different.
In other
New submission from James Paget:
The operator -= modifies a frozenset (this should not be possible),
instead of signaling a TypeError. Contrast with the += operator.
>>> f=frozenset([1,2])
>>> f
frozenset([1, 2])
>>> f -= frozenset([1])
>>> f
frozenset([2])
>>> f -= frozenset([2])
>>> f
frozens