Guido van Rossum wrote:
> [Brett C.]
>
>>Maybe, but as long as caught exceptions get cleared that should be an issue.
>>Would this be solved if, when an 'except' branch is exited, exceptions are
>>cleared? So, in the above example, once the 'pass' is hit in catchit() no
>>exception is considered
[Brett C.]
> Maybe, but as long as caught exceptions get cleared that should be an issue.
> Would this be solved if, when an 'except' branch is exited, exceptions are
> cleared? So, in the above example, once the 'pass' is hit in catchit() no
> exception is considered active any longer. This coul
Guido van Rossum wrote:
> [Guido]
>
>>>What if that method catches that exception?
>
>
> [Ka-Ping Yee]
>
>>Did you mean something like this?
>>
>>def handle():
>>try:
>>open('spamspamspam')
>>except:
>>catchit()
>># point A
>>.
[James Y Knight ]
> I think it's a bad idea to have this happen automatically. Many times
> if an exception is raised in the except clause, that doesn't
> necessarily imply it's related to the original exception. It just
> means there's a bug in the exception handler.
Yeah, but especially in that
James Y Knight wrote:
> Of course you can already do similar with current python, it just
> can't be spelled as nicely, and the default traceback printer won't
> use the info:
>
> try:
>raise AError
> except:
>newException = BError()
>newException.cause=sys.exc_info()
>raise newEx
On May 12, 2005, at 6:32 PM, Ka-Ping Yee wrote:
> Suppose exceptions have an optional "context" attribute, which is
> set when the exception is raised in the context of handling another
> exception. Thus:
>
> def a():
> try:
> raise AError
> except:
> r
[Guido]
> > What if that method catches that exception?
[Ka-Ping Yee]
> Did you mean something like this?
>
> def handle():
> try:
> open('spamspamspam')
> except:
> catchit()
> # point A
> ...
>
> def catchit():
> t
[Phillip J. Eby]
> I think the main problem is going to be that (IIUC), Python doesn't "know"
> when you've exited an 'except:' clause and are therefore no longer
> handling the exception.
But the compiler knows and could insert code to maintain this state.
> sys.exc_info() still gives you the e
At 07:36 PM 5/12/2005 -0500, Ka-Ping Yee wrote:
>On Thu, 12 May 2005, Brett C. wrote:
> > Guido van Rossum wrote:
> > > Try to come up with a precise specification and we'll talk.
> >
> > If a new exception is raised (e.g., not a bare 'raise') while a current
> > exception is active (e.g., sys.exc_
On Thu, 12 May 2005, Guido van Rossum wrote:
> Define "raise". Does that involve a raise statement?
Not necessarily; it could be a raise statement or an inadvertently
triggered exception, such as in the example code i posted.
> What about 1/0?
That counts.
> What if you call a method that execu
[Brett C.]
> If a new exception is raised (e.g., not a bare 'raise') while a current
> exception is active (e.g., sys.exc_info() would return something other than a
> tuple of None), then the new exception is made the active exception and the
> now
> old exception is assigned to the new exception'
On Thu, 12 May 2005, Brett C. wrote:
> Guido van Rossum wrote:
> > Try to come up with a precise specification and we'll talk.
>
> If a new exception is raised (e.g., not a bare 'raise') while a current
> exception is active (e.g., sys.exc_info() would return something other
> than a tuple of None)
Guido van Rossum wrote:
> [Ka-Ping Yee]
>
>>Suppose exceptions have an optional "context" attribute, which is
>>set when the exception is raised in the context of handling another
>>exception. Thus:
>>
>>def a():
>>try:
>>raise AError
>>except:
>>raise
[Ka-Ping Yee]
> Suppose exceptions have an optional "context" attribute, which is
> set when the exception is raised in the context of handling another
> exception. Thus:
>
> def a():
> try:
> raise AError
> except:
> raise BError
>
> yields an excepti
Suppose exceptions have an optional "context" attribute, which is
set when the exception is raised in the context of handling another
exception. Thus:
def a():
try:
raise AError
except:
raise BError
yields an exception which is an instance of BError.
15 matches
Mail list logo