Detect single letter variable names enumerated in PEP-0008#525
Detect single letter variable names enumerated in PEP-0008#525IanLee1521 merged 5 commits intoPyCQA:masterfrom
Conversation
Check for prohibited identifiers occuring to the lhs of an assignment operator or after the 'as' keyword. Closes PyCQA#341
| one and zero. When tempted to use 'l', use 'L' instead. | ||
|
|
||
| Okay: L = 0 | ||
| E741: l = 0 |
There was a problem hiding this comment.
Thanks @mtmiller ! Could you update the doc tests with the rest of the cases that are not allowed?
Also, the 'as' test cases are missing.
|
Further doctests for all 3 forbidden variable names added, as well as some tests on While hacking on this I realized I missed some other obvious cases such as for loop iterators and initialization of a list of variables such as |
|
Added checks for names after Now reports errors for almost everything in the original example in #341. Still missing checks for for loop iterators, function parameters, and the comma-separated lists of variables that can appear in assignments, for loops, arg lists, and |
|
This will have to be included in 2.1.0 or some other 2.x.0 release. |
|
Next version will be 2.1.0, going to go ahead and merge this. Thanks @mtmiller ! |
Fix for #341. Could be improved further to include named parameters, maybe other cases I can't think of where names are declared.