[Python-ideas] except expression

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 18 22:38:31 CET 2014


Chris Angelico wrote:
> I don't want to narrow this down to always having to catch everything.

Agreed, that would be unacceptably bad.

What *might* be useful is to allow the exception type to
be omitted, and have it default to LookupError. Then the
most common anticipated use cases would be very concise:

    things[i] except: default_value

-- 
Greg


More information about the Python-ideas mailing list