3 ms·
That particular gotcha has been fixed in Python 3: >>> try: ... x = 1 / int(s) ... except ZeroDivisionError, ValueError: File "<stdin>", li
by cesarb 9y ago
That particular gotcha has been fixed in Python 3:
>>> try:
... x = 1 / int(s)
... except ZeroDivisionError, ValueError:
File "<stdin>", line 3
except ZeroDivisionError, ValueError:
^
SyntaxError: invalid syntax
It now requires the "as" keyword. Also, AFAIK setting ValueError to something else affects only the current module; only modifying __builtins__.ValueError would affect other modules.