Re: [Python-ideas] syntax to continue into the next subsequent except block

I think it would be useful if there was a way to skip into the next except block, perhaps with continue as I think it's currently always illegal to use in an except block. I don't believe there's currently a way to do this.
I would like to share that the original suggestion inspired me on the following (mis-)adventure. Cheers, V James Powell switch = lambda val: type('', (BaseException,), {'val': val})() case = lambda pred: type('', (type,), {'__subclasscheck__': staticmethod(lambda x: pred(x.val))})('',(BaseException,),{}) default = BaseException #x = '%s' x = 12 try:raise switch(x) except case( lambda x: x % 2 == 0 ): print "It's even!" except case( lambda x: x % 2 == 1 ): print "It's odd!" except default: print "It's a joke!"
participants (1)
-
V James Powell