[Python-3000] Exception Expressions
Calvin Spealman
ironfroggy at gmail.com
Fri Sep 1 05:21:08 CEST 2006
On 8/31/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> One problem is that it doesn't seem to chain
> all that well. Suppose you had three files to
> try opening:
>
> open(name1) except (open(name2) except open(name3) if IOError) if IOError
>
> Maybe it would be better if the exception type
> and alternative expression were swapped over.
> Then you could write
>
> open(name1) except IOError then open(name2) except IOError then open(name3)
>
> Still rather unwieldy though. -0.7j, I think
> (the j to acknowledge that this is an imaginary
> proposal.:-)
>
> --
> Greg Ewing, Computer Science Dept, +--------------------------------------+
> University of Canterbury, | Carpe post meridiem! |
> Christchurch, New Zealand | (I'm not a morning person.) |
> greg.ewing at canterbury.ac.nz +--------------------------------------+
I considered the expr1 except exc_type then expr2 syntax, but it adds
a keyword without much need to do so. But, I suppose that isn't a
problem now that conditional expressions are in and then is already a
keyword.
I hereby upgrade this from imaginary proposal to real proposal status!
More information about the Python-3000
mailing list