[issue18162] Add index attribute to IndexError

Raymond Hettinger report at bugs.python.org
Sun Jun 16 05:01:29 CEST 2013


Raymond Hettinger added the comment:

I would also like to see a PEP or good python-dev discussion before embarking on all these API expansions.  There should be an evaluation of whether any existing code would benefit from it, whether the current "args" attribute is sufficient, whether the code bloat is worth it, etc.

Also, I'm unclear on whether you expect users to have to provide the index value in their own code (i.e. is "raise IndexError" to still be permitted or will all pure python code be required to use "raise IndexError(i)" and change existing code if they already use "raise IndexError("Out of range")).

If you don't change requirements for pure python code, then how can be even rely on the new attribute being there (i.e.  is "except IndexError as e:  print(e.index)" guaranteed to work?).

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18162>
_______________________________________


More information about the Python-bugs-list mailing list