summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2024-04-03 15:08:18 (GMT)
committerGitHub <noreply@github.com>2024-04-03 15:08:18 (GMT)
commit03f7aaf953f00bf2953c21a057d8e6e88db659c8 (patch)
tree2c22360de75785923d5431cad9d1a626cf6d0348
parentfc5f68e58ecfbc8c452e1c2f33a2a53d3f2d7ea2 (diff)
downloadcpython-03f7aaf953f00bf2953c21a057d8e6e88db659c8.zip
cpython-03f7aaf953f00bf2953c21a057d8e6e88db659c8.tar.gz
cpython-03f7aaf953f00bf2953c21a057d8e6e88db659c8.tar.bz2
gh-117215 Make the fromskey() signature match dict.fromkeys(). (gh-117493)
-rw-r--r--Lib/collections/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 2a35989..d06d84c 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -1038,9 +1038,9 @@ class ChainMap(_collections_abc.MutableMapping):
return f'{self.__class__.__name__}({", ".join(map(repr, self.maps))})'
@classmethod
- def fromkeys(cls, iterable, *args):
- 'Create a ChainMap with a single dict created from the iterable.'
- return cls(dict.fromkeys(iterable, *args))
+ def fromkeys(cls, iterable, value=None, /):
+ 'Create a new ChainMap with keys from iterable and values set to value.'
+ return cls(dict.fromkeys(iterable, value))
def copy(self):
'New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]'