This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients barry, brett.cannon, cvrebert, eric.araujo, ezio.melotti, rhettinger
Date 2013-06-16.04:29:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1371356945.97.0.955468989022.issue18162@psf.upfronthosting.co.za>
In-reply-to
Content
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:``).
History
Date User Action Args
2013-06-16 04:29:06brett.cannonsetrecipients: + brett.cannon, barry, rhettinger, ezio.melotti, eric.araujo, cvrebert
2013-06-16 04:29:05brett.cannonsetmessageid: <1371356945.97.0.955468989022.issue18162@psf.upfronthosting.co.za>
2013-06-16 04:29:05brett.cannonlinkissue18162 messages
2013-06-16 04:29:05brett.cannoncreate