Steven D'Aprano wrote:
Okay, if other people are doing it, I'm happy to rely on it as something
which shouldn't just go away without warning.
At least, it will not go away without fuss.
I would guess that modifying the message is an intended use of bare
'raise', but that is not documented.
Steven D'Aprano writes:
> Okay, if other people are doing it, I'm happy to rely on it as
> something which shouldn't just go away without warning. Thanks to
> everyone who replied.
If you only want to modify the exception's message string, the
‘message’ attribute is standard IIRC. No need to re-
Gabriel Genellina wrote:
> En Fri, 06 Mar 2009 04:29:16 -0200, Steven D'Aprano
> escribió:
...
>> The behaviour I want is from raise_example2, but I'm not sure if this is
>> documented behaviour, or if it is something I can rely on. Is it
>> acceptable to modify
e_example2()
> Traceback (most recent call last):
> File "", line 1, in ?
> File "", line 3, in raise_example2
> TypeError: modified error message
>
> Note how the line numbers in the traceback are different.
>
> The behaviour I want is from raise_e
The behaviour I want is from raise_example2, but I'm not sure if this is
documented behaviour, or if it is something I can rely on. Is it
acceptable
to modify an exception before re-raising it?
I don't completely understand your question. Is it about the bare raise?
It is docum
sage
>>>> raise_example2()
> Traceback (most recent call last):
> File "", line 1, in ?
> File "", line 3, in raise_example2
> TypeError: modified error message
>
> Note how the line numbers in the traceback are different.
>
> The behaviour I wan
d error message
Note how the line numbers in the traceback are different.
The behaviour I want is from raise_example2, but I'm not sure if this is
documented behaviour, or if it is something I can rely on. Is it acceptable
to modify an exception before re-raising it?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list