-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasgood first issue
Description
EAFP is an acronym that stands for "easier to ask forgiveness than permission" and describes a principle behind the pythonic way of doing some operations that may fail:
try:
do_smth()
except MyError:
do_smth_otherwise()
as opposed to
if i_can_do_smth():
do_smth()
else:
do_smth_otherwise()
pandas sources use this a lot but often the exception is caught with except:
which among other things intercept SystemExit
and KeyboardInterrupt
. Because of that it's possible that when you're trying to interrupt an operation it goes on simply choosing another code path.
There are valid use cases for carpet-catching excepts like that, most obvious ones being performing some cleanup and re-raising the error afterwards and catching all errors coming from evaluation of user-supplied code. In the rest of the cases except Exception:
should be used instead.
Metadata
Metadata
Assignees
Labels
Error ReportingIncorrect or improved errors from pandasIncorrect or improved errors from pandasgood first issue