30 ms·
exceptions are supposed to be exceptional, darn it This feeling is at odds with what is generally considered idiomatic Python, for better or worse. Upthread B
by Scramblejams 5y ago
exceptions are supposed to be exceptional, darn it
This feeling is at odds with what is generally considered idiomatic Python, for better or worse.
Upthread BiteCode mentioned EAFP. See, for example: https://devblogs.microsoft.com/python/idiomatic-python-eafp-versus-lbyl/ https://devblogs.microsoft.com/python/idiomatic-python-eafp-...
(It's certainly not unanimous. Guido himself is on the record as saying EAFP isn't better than LBYL, but in most of the Python I've cruised through these last umpteen years [that wasn't some other language written in Python], I've certainly seen an overall preference for EAFP. Naturally YMMV.)
- fouric 5y agoI think that implies that either "exceptions" are misnamed in Python (as in every other language with that name, they're meant to be exactly that - exceptional - so whatever Python calls "exceptions" isn't the same as in other languages), or that that particular idiom is wrong, and needs to be rethought.