Add types for typing library: Mutable, Immutable

It seems that we already have specific types of short ones called MutableSet, MutableSequance, …
Can we need this general type?

Are these ABCs, protocols, type qualifiers or what? How do they fit into the current type system?

1 Like

Assuming some relatively naive (read: not quite correct) semantics, like __setitem__ and __delitem__ being the key methods, I’m pretty sure this doesn’t work without negation.

If you want to work a lot with frozen types, I recommend looking into a tool like pyrsistent. Because the library has its own vocabulary of types – concrete ones – it’s pretty easy to build around the guarantees of immutability it provides.