Skip to content

Commit

Permalink
Merge pull request #14 from felixonmars/patch-1
Browse files Browse the repository at this point in the history
Correct a typo in README
  • Loading branch information
elijahandrews authored Mar 18, 2022
2 parents 8d1f469 + a44ad73 commit ddb9816
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A flake8 extension that checks for blind, catch-all ``except:`` and ``except Exc

As of `pycodestyle 2.1.0 <https://github.com/PyCQA/pycodestyle/commit/543f12b06592c53e2e60edc4846ee02ab9550e8b/>`_, "E722 do not use bare except, specify exception instead" is built-in. However, bare ``Exception`` and ``BaseException`` are still allowed. This extension flags them as `B902`.

Using ``except`` without explicitly specifying which exceptions to catch is generally considered bad practice, since it catches system signals like ``SIGINT``. You probably want to handle system interrupts differently than exceptions occuring in your code.
Using ``except`` without explicitly specifying which exceptions to catch is generally considered bad practice, since it catches system signals like ``SIGINT``. You probably want to handle system interrupts differently than exceptions occurring in your code.

It's also usually better style to have many small ``try``-``except`` blocks catching specific exceptions instead of a giant ``try:`` block with a catch-all ``except:`` at the bottom. It's also nicer to your fellow programmers to be a bit more specific about what exceptions they can expect in specific parts of the code, and what the proper course of action is when they occur.

Expand Down

0 comments on commit ddb9816

Please sign in to comment.