New submission from Daniel Lenski: Python 2.7 allows indexing an Exception object to access its args list.
>>> e=Exception('foo','bar','baz') >>> assert e[0] is e.args[0] This doesn't work in 3.5: >>> e=Exception('foo','bar','baz') >>> e.args[0] 'foo' >>> e[0] TypeError: 'Exception' object is not subscriptable This conversion (e[x] -> e.args[x]) seems like it ought to be fairly straightforward to support in 2to3. ---------- components: 2to3 (2.x to 3.x conversion tool) messages: 292799 nosy: dlenski priority: normal severity: normal status: open title: 2to3 doesn't detect or fix Exception indexing type: enhancement versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30238> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com