C
cnb
If I get zero division error it is obv a poor solution to do try and
except since it can be solved with an if-clause.
However if a program runs out of memory I should just let it crash
right? Because if not then I'd have to write exceptions everywhere to
prevent that right?
So when would I actually use try-except?
If there can be several exceptions and I just want to catch 1 or 2?
Like
try:
blahaba
except SomeError:
do something
except since it can be solved with an if-clause.
However if a program runs out of memory I should just let it crash
right? Because if not then I'd have to write exceptions everywhere to
prevent that right?
So when would I actually use try-except?
If there can be several exceptions and I just want to catch 1 or 2?
Like
try:
blahaba
except SomeError:
do something