On Wed, 24 Feb 2021 at 06:29, Random832 <random...@fastmail.com> wrote: > I was surprised, though, to find that you can't remove items directly from > the key set, or in general update it in place with &= or -= (these operators > work, but give a new set object).
This is because they are a view. Changing the key object means you will change the underlying dict. Probably not that you want or expect. You can just "cast" them into a "real" set object. There was a discussion to implement the whole Set interface for dicts. Currently, only `|` is supported. -- https://mail.python.org/mailman/listinfo/python-list