[Python-ideas] Block-Scoped Exception Handlers

Kyle Lahnakoski klahnakoski at mozilla.com
Wed May 4 18:34:04 EDT 2016


On 5/4/2016 4:51 PM, Random832 wrote:
> Where does control resume if it doesn't raise?
Control would resume just before the end of the block, not after it,
much like in the case of a `try` statement:

    for t in todo:
        pre_process()

        except Exception, e:
            print "problem"+unicode(e)
   
        process()
   
Would be the same as

    for t in todo:
       pre_process()

       try:
            process()
       except Exception, e:
           print "problem"+unicode(e)
   
so, the control resumes at the end of the `for` block, but still inside
the loop   





More information about the Python-ideas mailing list