69 <td>Split and strip and discard empties.</td> |
69 <td>Split and strip and discard empties.</td> |
70 </tr><tr> |
70 </tr><tr> |
71 <td><a href="#ambiguous_identifier">ambiguous_identifier</a></td> |
71 <td><a href="#ambiguous_identifier">ambiguous_identifier</a></td> |
72 <td>Never use the characters 'l', 'O', or 'I' as variable names.</td> |
72 <td>Never use the characters 'l', 'O', or 'I' as variable names.</td> |
73 </tr><tr> |
73 </tr><tr> |
|
74 <td><a href="#bare_except">bare_except</a></td> |
|
75 <td>When catching exceptions, mention specific exceptions whenever possible.</td> |
|
76 </tr><tr> |
74 <td><a href="#blank_lines">blank_lines</a></td> |
77 <td><a href="#blank_lines">blank_lines</a></td> |
75 <td>Separate top-level function and class definitions with two blank lines.</td> |
78 <td>Separate top-level function and class definitions with two blank lines.</td> |
76 </tr><tr> |
79 </tr><tr> |
77 <td><a href="#break_around_binary_operator">break_around_binary_operator</a></td> |
80 <td><a href="#break_around_binary_operator">break_around_binary_operator</a></td> |
78 <td>Avoid breaks before binary operators.</td> |
81 <td>Avoid breaks before binary operators.</td> |
754 E741: with lock as l: |
757 E741: with lock as l: |
755 E741: global I |
758 E741: global I |
756 E741: nonlocal l |
759 E741: nonlocal l |
757 E742: class I(object): |
760 E742: class I(object): |
758 E743: def l(x): |
761 E743: def l(x): |
|
762 </p> |
|
763 <div align="right"><a href="#top">Up</a></div> |
|
764 <hr /><hr /> |
|
765 <a NAME="bare_except" ID="bare_except"></a> |
|
766 <h2>bare_except</h2> |
|
767 <b>bare_except</b>(<i>logical_line, noqa</i>) |
|
768 <p> |
|
769 When catching exceptions, mention specific exceptions whenever possible. |
|
770 </p><p> |
|
771 Okay: except Exception: |
|
772 Okay: except BaseException: |
|
773 E722: except: |
759 </p> |
774 </p> |
760 <div align="right"><a href="#top">Up</a></div> |
775 <div align="right"><a href="#top">Up</a></div> |
761 <hr /><hr /> |
776 <hr /><hr /> |
762 <a NAME="blank_lines" ID="blank_lines"></a> |
777 <a NAME="blank_lines" ID="blank_lines"></a> |
763 <h2>blank_lines</h2> |
778 <h2>blank_lines</h2> |
1175 </p><p> |
1190 </p><p> |
1176 Okay: import os |
1191 Okay: import os |
1177 Okay: # this is a comment\nimport os |
1192 Okay: # this is a comment\nimport os |
1178 Okay: '''this is a module docstring'''\nimport os |
1193 Okay: '''this is a module docstring'''\nimport os |
1179 Okay: r'''this is a module docstring'''\nimport os |
1194 Okay: r'''this is a module docstring'''\nimport os |
1180 Okay: try:\n import x\nexcept:\n pass\nelse:\n pass\nimport y |
1195 Okay: |
1181 Okay: try:\n import x\nexcept:\n pass\nfinally:\n pass\nimport y |
1196 try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y |
|
1197 Okay: |
|
1198 try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y |
|
1199 </p><p> |
1182 E402: a=1\nimport os |
1200 E402: a=1\nimport os |
1183 E402: 'One string'\n"Two string"\nimport os |
1201 E402: 'One string'\n"Two string"\nimport os |
1184 E402: a=1\nfrom sys import x |
1202 E402: a=1\nfrom sys import x |
1185 </p><p> |
1203 </p><p> |
1186 Okay: if x:\n import os |
1204 Okay: if x:\n import os |