Is python exception handling more efficient than PHP and/or other languages?

前端 未结 6 981
遥遥无期
遥遥无期 2021-01-03 21:32

I have it drilled into my head that (at least in PHP) it is badbadmojo to use try... catch blocks for flow control. What I\'ve learned is to use them only to h

6条回答
  •  春和景丽
    2021-01-03 22:02

    There's a specific exception that is only supposed to be used in normal execution flow: StopIteration. This implies to me that Python's creator doesn't think exception overhead is out of line.

    Whether this is because exception handling is uber-efficient or the rest of the language is just slow by comparison is another question...

提交回复
热议问题