mirror of https://github.com/python/cpython
gh-117215 Make the fromskey() signature match dict.fromkeys(). (gh-117493)
This commit is contained in:
parent
fc5f68e58e
commit
03f7aaf953
|
@ -1038,9 +1038,9 @@ class ChainMap(_collections_abc.MutableMapping):
|
||||||
return f'{self.__class__.__name__}({", ".join(map(repr, self.maps))})'
|
return f'{self.__class__.__name__}({", ".join(map(repr, self.maps))})'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def fromkeys(cls, iterable, *args):
|
def fromkeys(cls, iterable, value=None, /):
|
||||||
'Create a ChainMap with a single dict created from the iterable.'
|
'Create a new ChainMap with keys from iterable and values set to value.'
|
||||||
return cls(dict.fromkeys(iterable, *args))
|
return cls(dict.fromkeys(iterable, value))
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'
|
'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'
|
||||||
|
|
Loading…
Reference in New Issue