summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Miller <mike@mtmxr.com>2016-06-02 16:27:33 -0700
committerMike Miller <mike@mtmxr.com>2016-06-02 16:27:33 -0700
commit4c8152c7da74d7f7e20d3ae98b52581ef1b0f16b (patch)
tree63f09b96127b34a83ff3e31698b14d9b049db80c
parent26893dafe4562caefeb200c990972bc6262842d9 (diff)
downloadpep8-4c8152c7da74d7f7e20d3ae98b52581ef1b0f16b.tar.gz
Add more doctests for E741
-rwxr-xr-xpycodestyle.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pycodestyle.py b/pycodestyle.py
index ad1b463..38648a3 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -1157,7 +1157,19 @@ def ambiguous_identifier(logical_line, tokens):
one and zero. When tempted to use 'l', use 'L' instead.
Okay: L = 0
+ Okay: o = 123
+ Okay: i = 42
E741: l = 0
+ E741: O = 123
+ E741: I = 42
+
+ Variables can be bound in other contexts, so identifiers appearing after
+ the 'as' keyword are also reported:
+
+ Okay: except AttributeError as o:
+ Okay: with lock as L:
+ E741: except AttributeError as O:
+ E741: with lock as l:
"""
idents_to_avoid = ('l', 'O', 'I')
prev_type, prev_text, prev_start, prev_end, __ = tokens[0]