gh-117215 Make the fromskey() signature match dict.fromkeys(). (gh-117493)

This commit is contained in:
Raymond Hettinger 2024-04-03 10:08:18 -05:00 committed by GitHub
parent fc5f68e58e
commit 03f7aaf953
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -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:]'