New submission from Jonathan Ellis <ell...@users.sourceforge.net>: 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! ---------- components: Interpreter Core messages: 86826 nosy: ellisj severity: normal status: open title: __repr__ is ignored when formatting exceptions type: behavior versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5882> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com