[Python-ideas] exception based conditional expression, similar to if-else conditional expression
Steven D'Aprano
steve at pearwood.info
Sun Aug 23 03:39:54 CEST 2009
On Sun, 23 Aug 2009 05:53:33 am Ron Adam wrote:
> An additional note, the when you view an exception object in the
> console it is bracketed by the less than and and greater than signs.
> Maybe there is a way to use those in a manner that is consistent
> with the string repr() returns.
Lots of things have a repr() which includes < and > signs, including
repr() itself.
>>> print repr
<built-in function repr>
Also new style classes and instances, types, functions, methods, etc.
Exceptions are printed with < > signs because exceptions are subclasses
of object. There's nothing specifically "exception-like" about the use
of < and > in the repr of exceptions.
--
Steven D'Aprano
More information about the Python-ideas
mailing list