[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#887105: RFP: python3-flake8-blind-except -- A flake8 extension that checks for blind, catch-all except statements



Package: wnpp
Severity: wishlist

* Package name    : python3-flake8-blind-except
  Version         : 0.1.1
  Upstream Author : Elijah Andrews
* URL             : https://github.com/elijahandrews/flake8-blind-except
* License         : MIT https://github.com/elijahandrews/flake8-blind-except/blob/master/LICENSE
  Programming Lang: Python
  Description     : A flake8 extension that checks for blind, catch-all except statements

A flake8 extension that checks for blind, catch-all except: statements.

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.

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.


Reply to: