[Python-ideas] except expression
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Feb 18 07:37:10 CET 2014
Rob Cliffe wrote:
>
> On 17/02/2014 22:26, Greg Ewing wrote:
>
>> menu.remove(mint) except ValueError: pass
>
> I'm starting to like it, although it introduces an inconsistency
> between expressions whose values are used and those whose values are not
> used.
If it helps, you could think of this form of the syntax
as a statement rather than an expression. It's an
abbreviation for
try:
menu.remove(mint)
except ValueError:
pass
which you wouldn't otherwise be able to write on one line.
--
Greg
More information about the Python-ideas
mailing list