Brett Cannon added the comment:

Obviously it can't be required that the index be provided as that would break 
way too much code. There are already exceptions in the stdlib that have 
optional attributes you can choose to (not) set.

As for relying upon it, it would be just like any other object that gets a new 
attribute: either you rely on it because you know the code you are using always 
provides it (e.g. using core/stdlib code directly) or you use some way to deal 
with cases where it was not set (EAFP or LBYL). Subclassing IndexError to 
provide a inheritance guarantee that an attribute exists seems like overkill 
(e.g. IndexError2 so you can do ``except IndexError2 as exc:``).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to