In Python, try/except is commonly used for control flow, and not just for error han‐ dling. There’s even an acronym/slogan for that documented in the official Python glos‐ sary: EAFP Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the as‐ sumption proves false. This clean and fast style is characterized by the presence of many try and except statements. The technique contrasts with the LBYL style com‐ mon to many other languages such as C.
关于·FAQ·API·我们的愿景·广告投放·感谢·实用小工具· 4083 人在线最高记录 5043· Select Language
World is powered by solitude
VERSION: 184.108.40.206 · 18ms · UTC 07:03 · PVG 15:03 · LAX 23:03 · JFK 02:03 ♥ Do have faith in what you're doing.