Are "cheap exceptions" common in interpreted languages?

Coming from a C ++ background where I learned to limit the use of exceptions to exceptional circumstances, I was very surprised at the cheap Python exceptions . In fact, some language features like iteration seem to rely on exceptions that are thrown. This makes sense when considering that the interpreter (python) needs to guarantee its own integrity and thus performs multiple checks.

Does it make sense to expect cheap interpretations to be normal in interpreted languages?

Edit:

To make it clear that this question is not primarily about performance, I should add that I am trying to expand my programming skills by learning new languages. I would never use exceptions in exceptional circumstances in C ++ or Pascal, but in python I obviously should (and it may not be the only language). And since this creates a structural difference for my code if I do or do not use exceptions, a simple guideline / rule of thumb will help get started in a new language.

+3


source to share


1 answer


Look in perspective:

Everything is cheap in C ++ except for exceptions.



Python exceptions are about as long as normal stuff.

+3


source







All Articles