◐ Shell
clean mode source ↗

Message 396289 - Python tracker

> There is no way to know through static analysis that the subscript is on an object of type exception. I think this should be closed as won't fix.

In almost all cases, the variable in question will receive its value via `except ... as e:`.

   try:
       ...
   except (Exception1, Exception2, ...) as e:
       e[0]

Seems to me that it should be possible for 2to3 to handle this large subset of applicable cases via static analysis.