On Wed, Feb 19, 2014 at 3:09 AM, MRAB
The question is whether it should be OK to allow a bare except, where that would catch a limited number of exceptions, in those cases where there won't be any risk.
Yeah. I don't like the idea that omitting the exception name(s) would have a completely different effect in expression or statement form. Compare: value = true_value if condition else false_value # <-> if condition: value = true_value else: value = false_value func = lambda x: x+4 # <-> def func(x): return x+4 lst = [x*x for x in range(5)] # <-> lst = [] for x in range(5): lst.append(x*x) Each of them has a "corresponding statement form" that's more-or-less the same in effect (little stuff like name leakage aside), and which is spelled very similarly. You wouldn't expect, for instance, lambda functions to specify their args in reverse order compared to def functions. So if it's syntactically legal to have a bare except in an expression (still under debate), then that bare except should be equivalent to "except BaseException" - not "except Exception", not "except DWIMException", not anything else. Otherwise it'd just cause confusion when trying to decode a complex expression. ChrisA