Exception as flow control | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

23rd Apr 2020, 2:31 PM
ifl
ifl - avatar
2 Answers
+ 2
HonFu yes something like that.
23rd Apr 2020, 6:27 PM
ifl
ifl - avatar
+ 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)
23rd Apr 2020, 3:03 PM
HonFu
HonFu - avatar