Description
#6042/#6044 gives me new mypy complaints on my code base.
ChainMap
only ever writes to the first mapping in maps
. That's my understanding. For example ChainMap({}, defaults)
is a typical use-case where the user gets a dict-like and cannot mutate the defaults. That's the typical stacking property of the ChainMap, you only ever mutate the top, most recent mapping.
From my understanding:
def __init__(self):
def __init__(self, __map: MutableMapping):
def __init__(self, __map: MutableMapping, *maps: ImmutableMapping):
I don't think we can have correct hints for the maps
member, and new_child
of course expects a mutable mapping because iirc it is exactly the next top most thing on the stack.
Originally posted by @kaste in #6042 (comment)
(I started this as a comment on the closed issue but closed issues don't move and I got initial supportive feedback on my comment from @hauntsaninja.)