[Python-3000] Exception Expressions (original) (raw)
Calvin Spealman ironfroggy at gmail.com
Thu Aug 31 23:50:02 CEST 2006
- Previous message: [Python-3000] Exception Expressions
- Next message: [Python-3000] Exception Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/31/06, Brett Cannon <brett at python.org> wrote:
So this feels like the Perl idiom of using die:
open(file) or die(or something like that; I have never been a Perl guy so I could be off).> ... The problem I have with this whole proposal is that catching exceptions should be very obvious in the source code. This proposal does not help with that ideal. So I am -1 on the whole idea. -Brett
"Ouch" on the associated my idea with perl!
Although I agree that it is good to be obvious about exceptions, there are some cases when they are simply less than exceptional. For example, you can do d.get(key, default) if you know something is a dictionary, but for general mappings you can't rely on that, and may often use exceptions as a kind of logic control. No, that doesn't sync with the purity of exceptions, but sometimes practicality and real-world usage trumps theory.
Only allowing a single expression, it shouldn't be able to get ugly. Also, maybe I hate to admit it but it could allow 'expr1 except expr2' as pretty something more like the 'or die' paradigm.
- Previous message: [Python-3000] Exception Expressions
- Next message: [Python-3000] Exception Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]