Re: Python Exceptions

Reimer Behrends (behrends@buran.fb10.tu-berlin.de)
6 Jan 1995 12:19:31 GMT

Alex Kowalenko (alex@jolt.mpx.com.au) wrote:
: Why do python exceptions have to be strings, couldn't they be a object that
: has a __str__ method defined returning the string wanted. If they could
: be we could throw generic objects around that can contain other actions.

Well, you could just use the second argument to raise/except to do just
that. For instance, the posix module passes a 2-tuple (errno,errstr) as
the second argument.

Reimer Behrends