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, r.david.murray, rhettinger
Date 2013-06-12.17:36:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
What David said. =)

The fact that the key is the first value from args is almost happenstance as the exception message is customized in __str__() and not in what is passed to the exception. But what if I had defined __getattr__ or __getattribute__ and had some prefix requirement? It would be more helpful to say ``KeyError("{!r} does not start with py_".format(key))`` which breaks your args[0] usage but is a much more descriptive message and has no defined way to provide the key as an attribute.

It's basically "explicit is better than implicit" since there is no API guarantee that the first thing in 'args' for KeyError will in actuality be the key.
Date User Action Args
2013-06-12 17:36:23brett.cannonsetrecipients: + brett.cannon, barry, rhettinger, r.david.murray
2013-06-12 17:36:23brett.cannonsetmessageid: <>
2013-06-12 17:36:23brett.cannonlinkissue18163 messages
2013-06-12 17:36:23brett.cannoncreate