summaryrefslogtreecommitdiff
path: root/pylint/checkers/refactoring.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r--pylint/checkers/refactoring.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py
index dd19dfbe5..e8f35ca5c 100644
--- a/pylint/checkers/refactoring.py
+++ b/pylint/checkers/refactoring.py
@@ -1112,6 +1112,10 @@ class RecommandationChecker(checkers.BaseChecker):
iterating_object = len_args[0]
if not isinstance(iterating_object, astroid.Name):
return
+ # If we're defining __iter__ on self, enumerate won't work
+ scope = node.scope()
+ if iterating_object.name == "self" and scope.name == "__iter__":
+ return
# Verify that the body of the for loop uses a subscript
# with the object that was iterated. This uses some heuristics