[Python-checkins] replace `self` param with more appropriate `cls` in classmethods (GH-31402) (#31445)

asvetlov webhook-mailer at python.org
Sun Feb 20 19:10:40 EST 2022


https://github.com/python/cpython/commit/e7115d53632bebf137ca7245a9ced7107c082e99
commit: e7115d53632bebf137ca7245a9ced7107c082e99
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: asvetlov <andrew.svetlov at gmail.com>
date: 2022-02-21T02:10:35+02:00
summary:

replace `self` param with more appropriate `cls` in classmethods (GH-31402) (#31445)

(cherry picked from commit a3fcca4af1cb418dc802feb75100ecc1a286afaa)

Co-authored-by: Josh Smith <cmyuiosu at gmail.com>

Co-authored-by: Josh Smith <cmyuiosu at gmail.com>

files:
M Lib/_collections_abc.py

diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py
index acfaff802f506..023ac7cf03695 100644
--- a/Lib/_collections_abc.py
+++ b/Lib/_collections_abc.py
@@ -816,7 +816,7 @@ class KeysView(MappingView, Set):
     __slots__ = ()
 
     @classmethod
-    def _from_iterable(self, it):
+    def _from_iterable(cls, it):
         return set(it)
 
     def __contains__(self, key):
@@ -834,7 +834,7 @@ class ItemsView(MappingView, Set):
     __slots__ = ()
 
     @classmethod
-    def _from_iterable(self, it):
+    def _from_iterable(cls, it):
         return set(it)
 
     def __contains__(self, item):



More information about the Python-checkins mailing list