Douglas Alan wrote:
> Lenard Lindstrom <[EMAIL PROTECTED]> writes:
>
>> Explicitly clear the exception? With sys.exc_clear?
>
> Yes. Is there a problem with that?
>
As long as nothing tries to re-raise the exception I doubt it breaks
anything:
>>> import sys
>>> try:
raise StandardError("Hello")
except StandardError:
sys.exc_clear()
raise
Traceback (most recent call last):
File "<pyshell#6>", line 5, in <module>
raise
TypeError: exceptions must be classes, instances, or strings
(deprecated), not NoneType
But it is like calling the garbage collector. You are tuning the program
to ensure some resource isn't exhausted. It relies on implementation
specific behavior to be provably reliable*. If this is indeed the most
obvious way to do things in your particular use case then Python, and
many other languages, is missing something. If the particular problem is
isolated, formalized, and general solution found, then a PEP can be
submitted. If accepted, this would ensure future and cross-platform
compatibility.
* reference counting is an integral part of the CPython C api so cannot
be changed without breaking a lot of extension modules. It will remain
as long as CPython is implemented in C.
---
Lenard Lindstrom
<[EMAIL PROTECTED]>
--
http://mail.python.org/mailman/listinfo/python-list