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

前端 未结 6 979
遥遥无期
遥遥无期 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:01

    the great Alex Martelli gives a good overview of EAFP vs. LBYL in the book 'Python In A Nutshell'. (He heavily leans towards using EAFP)

    def worth reading:
    http://books.google.com/books?id=JnR9hQA3SncC&lpg=PA134&ots=JaaWGy-24u&dq=alex%20martelli%20eafp%20lbyl&pg=PA134#v=onepage&q&f=false

提交回复
热议问题