[Python-3000] threading, part 2 (original) (raw)

tomer filiba tomerfiliba at gmail.com
Tue Aug 8 20:22:24 CEST 2006


let me bring this anew, as the the previous discussion has gone quite off tracks. i know there are many theories/paradigms concerning parallel execution, some require language level constructs, other being external, and let's not ever start talking about the GIL.

(on a side note, if i may add my opinion on the subject matter, stackless python has the best approach to concurrency -- don't lock, yield!)

my previous suggestion asked for is a means to raise exceptions in the context of other threads. all it calls for is for a new builtin function, that would raise a given exception at the context of a given thread.

there are some points to address:

about forcefully killing the thread, without cleanup.

after all, exceptions can occur anywhere in the code, and at any time... you code should always be aware of that, with no regard to being thread-safe.

for example: def f(a, b): return a + b

an innocent function, but now suppose i pass two huge strings... bad input can cause MemoryError, although unlikely. you can't take care of everything, you must learn to live with the occasional unexpected exception.

so it's may seem brute to suggest a mechanism that raises exceptions at arbitrary points in your code-flow, but:

sounds better now?

-tomer -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-3000/attachments/20060808/ee3aa259/attachment.htm



More information about the Python-3000 mailing list