[Python-Dev] Chaining try statements: eltry?

Anthony Baxter anthony at interlink.com.au
Fri Jul 8 19:34:45 CEST 2005


On Friday 08 July 2005 04:54, Guido van Rossum wrote:
> How would a PEP to *remove* this feature fare today?

I'd very much prefer that we kept them. I find it a useful
way to group the behaviour of the looping - this bit is
the normal loop, and this bit at the end is when the loop
fails/is exhausted. This is obviously for when you use it in 
a loop where you're looking for a certain result. And yes, 
you can do something similar with try/except, but I find 
that ugly - 'break' is the natural way to get out of a loop, 
not 'raise'. I find using exceptions in this way to be a
sort of horrible goto-hack, and makes the code hard on the
brain. 

(obdisclaimer: for/else gets a mention in my OSCON python
tutorial, so I'd appreciate it if you _don't_ rip it out
in the next month <wink>)

Anthony
-- 
Anthony Baxter     <anthony at interlink.com.au>
It's never too late to have a happy childhood.


More information about the Python-Dev mailing list