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 Anthony Sottile
Recipients Anthony Sottile
Date 2020-09-12.00:17:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599869824.76.0.302997879758.issue41767@roundup.psfhosted.org>
In-reply-to
Content
For example:

>>> import pwd
>>> pwd.getpwnam("test")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: "getpwnam(): name not found: 'test'"


An improvement would be something which doesn't have the extra set of quotes such as:

>>> import pwd
>>> pwd.getpwnam("test")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: getpwnam(): name not found: 'test'



I understand this is due to the `KeyError` repr, I wonder if something could be done to improve this (maybe a subclass of KeyError? maybe a new  optional named-only argument to KeyError?)


Seems there are others which could be improved here as well:

>>> import unicodedata
>>> unicodedata.lookup('zzz')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: "undefined character name 'zzz'"
History
Date User Action Args
2020-09-12 00:17:04Anthony Sottilesetrecipients: + Anthony Sottile
2020-09-12 00:17:04Anthony Sottilesetmessageid: <1599869824.76.0.302997879758.issue41767@roundup.psfhosted.org>
2020-09-12 00:17:04Anthony Sottilelinkissue41767 messages
2020-09-12 00:17:04Anthony Sottilecreate