[Python-Dev] PEP 343 - Abstract Block Redux

Eric Nieuwland eric.nieuwland at xs4all.nl
Sun May 15 11:12:58 CEST 2005


Shane Hathaway wrote:
> Here is example A, a non-looping block statement using "try":
>
>     text = 'diamond'
>     for fn in filenames:
>         try opening(fn) as f:
>             if text in f.read():
>                 print 'I found the text in %s' % fn
>                 break

That's a pretty way to write it!
Would it be possible to extend the 'try' syntax in this way?
It would certainly stress the fact that this construct includes 
exception handling.

--eric



More information about the Python-Dev mailing list