[Python-3000] Exception Expressions

Brett Cannon brett at python.org
Fri Sep 1 00:18:17 CEST 2006

On 8/31/06, Calvin Spealman <ironfroggy at gmail.com> wrote:
> 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!

=)  The truth hurts.

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.

Practically most definitely beats purity, but I don't see the practicality
of this over  what we already have.

Only allowing a single expression, it shouldn't be able to get ugly.

Famous last words.  Remember a big argument against the 'if' expressions was
about them getting too unwieldly in terms of length and obscuring the fact
that it is a conditional.  I have used 'if' expressions and they have been
hard to keep very readable unless you are willing to use parentheses and
make them unreadable.  I would be afraid of this happening here, but to an
even more important construct that should always be easy to spot in source

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060831/f41c8b7d/attachment.htm 

More information about the Python-3000 mailing list