为什么在Python中捕获所有异常是一个坏主意?
据我所知,追赶使用的所有例外except:条款,甚至会搭上"特别"蟒蛇例外:SystemExit,KeyboardInterrupt,和GeneratorExit.那么为什么不使用一个except Exception:子句来捕获所有异常呢?
except:
SystemExit
KeyboardInterrupt
GeneratorExit
except Exception:
python exception-handling exception
exception ×1
exception-handling ×1
python ×1