[Python-ideas] syntax to continue into the next subsequent except block

Gregory P. Smith greg at krypto.org
Sat Sep 15 08:28:59 CEST 2012


On Thu, Sep 13, 2012 at 5:26 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:

> Paul Wiseman wrote:
>
>> try:
>>     operation()
>> except IOError as err:
>>     if err.errno == 2:
>>         do_something()
>>     else:
>>         continue #This would continue the except down to the next check,
>>
>
> I think a better way to address this would be to allow guard
> expressions on the except clauses.
>
>
>    try:
>       operation()
>    except IOError as err if err.errno == 2:
>       ...


I like that.  Granted, what are the use cases beyond the errno one that PEP
3151 largely addresses?


>
>
> --
> Greg
>
> ______________________________**_________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/**mailman/listinfo/python-ideas<http://mail.python.org/mailman/listinfo/python-ideas>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120914/dcc5ed88/attachment.html>


More information about the Python-ideas mailing list