Why the variable used in the except statement is removed? I mean doing:
x = 0
try:
x = 5/0
except ZeroDivisionError as x:
pass
print(x)
I get NameError: name 'x' is not defined why this? Couldn't it work as with def or comprehensions where if there is a variable with same name of a variable in the enclosing function (or module) it is simply shadowed but not removed?