Jeff McAninch wrote:
> Should be legal, right?, since syntax would be> <expression> except <expression> if <exception>> > Dino Viehland wrote:>> On option 1 is this legal then?>>>> x = float(string) except float('nan') if some_check() else >> float('inf') if ValueError>>>> > Thinking more about the syntax options: if P.J.'s "if" Option is used, > it should also be optional.> That is, I would want this to also be legal,> <expression> except <expression>> to trap any exception when robustness is more important than catching a > specific exception.
Catch all exceptions:
<expression> except <expression>
Catch specific exceptions, optionally catching all others:
<expression> except (<expression> if <exception>)+ [else <expression>]
Of course, a catch-all is a bare except, with all its dangers!
> > What would be the typical next step in trying to put this forward? A > draft PEP?>