How to get a raised exception from other thread

Lasse Vågsæther Karlsen lasse at vkarlsen.no
Mon Oct 17 10:18:06 EDT 2005


Steve Holden wrote:
<snip>
>> Why should the coder of this software have to go through this
>> deliberate set up attrition, to get at this functionality, just
>> because it wasn't intented to be used in such a way by the
>> developers?
>>
> Because otherwise people who know no better will use the feature for 
> purposes where it's not the best way to achieve the required 
> functionality, leading to yet more endless discussions about why "it 
> doesn't work". Asynchronous signalling between threads is an accident 
> waiting to happen in the hands of an inexperienced programmer.

I can't agree with that opinion. There's tons of features of existing 
programming languages and systems, Python included, that is pretty much 
guaranteed to be misused, and badly at that. We can't remove those just 
on the off chance someone might start a thread on a newsgroup about why 
this is or isn't the best way to do things. If we do that then I guess 
list comprehension is out the window because there's tons of posts (from 
me included) that get this wrong.

The point of a programming language is not to dumb down the environment 
to a point where it is impossible to write bad code. Instead it's about 
empowering the programmers to be able to accomplish their tasks.

In any case, this exception-in-another-thread problem has inherent 
issues which must be solved, among others:

- C extension code can't be interrupted
- an exception thrown at the wrong time in a finally/except block might 
cause more problems than it intends to solve

So until a good implementation exists, there shouldn't be any point in 
actually discussing the motives of the programmers who wishes to use the 
feature.

<snip>

-- 
Lasse Vågsæther Karlsen
http://usinglvkblog.blogspot.com/
mailto:lasse at vkarlsen.no
PGP KeyID: 0x2A42A1C2



More information about the Python-list mailing list