It works great here (under Python 2.x).
>>> try: ... foo ... except None as e: ... pass ... Traceback (most recent call last): File "<stdin>", line 2, in <module> NameError: name 'foo' is not defined
For an except clause with an expression, this expression is evaluated, and this clause corresponds to an exception if the resulting object is "compatible" with the exception. An object is compatible with an exception if it is the class or base class of the exception object, or a tuple containing an element compatible with the exception.
a source
Therefore, an expression should not be an exception type, it simply cannot match.
This behavior has been changed in Python 3.x, and the expression after except must be a descendant of BaseException or a tuple of such.
Ignacio Vazquez-Abrams
source share