[Python-ideas] except expression

Rob Cliffe rob.cliffe at btinternet.com
Tue Feb 18 16:30:39 CET 2014


On 18/02/2014 15:26, Alexander Belopolsky wrote:
>
> On Tue, Feb 18, 2014 at 10:13 AM, MRAB <python at mrabarnett.plus.com 
> <mailto:python at mrabarnett.plus.com>> wrote:
> >
> > Another possibility would be to say that a bare except in an expression
> > catches only certain "expression-oriented" exceptions, e.g. ValueError.
> > The simplest way to do that would be to make them subclasses of an
> > ExpressionError class.
>
>
> +1
>
> >
> > The question then becomes one of which
> > exceptions are "expression-oriented"...
>
> Here is my attempt to answer:
>
> - ArithmeticError
> - AttributeError
> - LookupError
> - TypeError ?
> - ValueError ?
>
>
Sorry, but this seems to me to be a futile discussion.
Expressions can contain functions.
Functions can raise any exception they like.
So evaluating an expression can raise any exception you care to name.
Rob Cliffe
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
> No virus found in this message.
> Checked by AVG - www.avg.com <http://www.avg.com>
> Version: 2012.0.2247 / Virus Database: 3705/6602 - Release Date: 02/17/14
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140218/4b7d3adb/attachment.html>


More information about the Python-ideas mailing list