+ 2
Exception as flow control
Is it really bad to use exception as flow control? And if this is the case, why is it accepted in python?
3 Réponses
+ 2
HonFu yes something like that.
+ 1
What do you mean with flow control?
Like for example:
try:
x = int(input())
except:
print('Please enter an int')
Instead of this?
x = input()
if not x.isdigit():
print('Please enter an int')
else:
x = int(x)