6 Oct
2021
6 Oct
'21
3:59 p.m.
Łukasz Langa wrote:
Joking aside, since we allow any expression after 'except' 'group' then this is indeed ambiguous. In theory!
Another option (to remove the ambiguity) could be to move the “group” after the expression. Bonus points for reading more clearly: except MemoryError group as e: … except (KeyError, IndexError) group as e: … except some + expression group as e: … And edge-cases like this still work normally: except some + group as e: …