https://github.com/python/cpython/commit/03f7aaf953f00bf2953c21a057d8e6e88db659c8
commit: 03f7aaf953f00bf2953c21a057d8e6e88db659c8
branch: main
author: Raymond Hettinger <[email protected]>
committer: rhettinger <[email protected]>
date: 2024-04-03T10:08:18-05:00
summary:

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

files:
M Lib/collections/__init__.py

diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 2a35989ee25a5e..d06d84cbdfcc36 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -1038,9 +1038,9 @@ def __repr__(self):
         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:]'

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to