Is there any difference between
except:
and except Exception:
?
Can except
deal with anything that is not an exception?
As of Python 2.5, there is a new BaseException
which serve as base class for Exception
. As result, something like GeneratorExit that inherents directly from BaseException
would be caught by except:
but not by except Exception:
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With