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 ellisj
Recipients ellisj
Date 2009-04-29.21:36:15
SpamBayes Score 7.526276e-05
Marked as misclassified No
Message-id <1241040977.95.0.976724243821.issue5882@psf.upfronthosting.co.za>
In-reply-to
Content
The docs say that "If a class defines __repr__() but not __str__(), then
__repr__() is also used when an “informal” string representation of
instances of that class is required."

but, repr is ignored:
>>> class E(Exception):
...     def __repr__(self):
...         return 'fancy!'
...
>>> raise E()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
__main__.E

only str is respected:
>>> class E(Exception):
...     def __str__(self):
...         return 'fancy!'
...
>>> raise E()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
__main__.E: fancy!
History
Date User Action Args
2009-04-29 21:36:18ellisjsetrecipients: + ellisj
2009-04-29 21:36:17ellisjsetmessageid: <1241040977.95.0.976724243821.issue5882@psf.upfronthosting.co.za>
2009-04-29 21:36:16ellisjlinkissue5882 messages
2009-04-29 21:36:15ellisjcreate