[Pythonmac-SIG] PackageManager / Python 2.3.x - 2.4 ideas
Bob Ippolito
bob at redivi.com
Thu Jul 31 21:09:30 EDT 2003
On Thursday, Jul 31, 2003, at 19:23 America/New_York, Stuart Bishop
wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> On Friday, August 1, 2003, at 12:21 AM, Schollnick, Benjamin wrote:
>
>>> Package Manager should be a responsive application, either by using
>>> nonblocking methods to speak with spawned processes. Threading sucks
>>> in python, let's not try and use it too much.
>>
>> I admit, I haven't used threading too much....
>>
>> But, are any steps being taken in the Python Development circles to
>> resolve the "Threading Sucks" issues?
>
> 'Threading Sucks' isn't a development issue - it is an education
> issue. If someone has a problem with threading, the first step
> would be to better articulate their issues. It isn't going to
> be fixed if people don't think it is broken. Whenever I've used
> threads, I've really liked the Python implementation :-)
It's a *lot* easier to predict what a single threaded application is
going to do. With threads, there's a whole slew of very difficult to
reproduce problems you have to think about and deal with. There's no
really good reason to use threads in pure python code due to the GIL,
especially now that we have generators and/or stackless. Even then,
using threads in C code can be sketchy, especially if the C code makes
threads that python didn't, or if you're expecting callbacks to work.
It's just a huge hassle, and I've found avoiding them whenever possible
is the best solution.
If you can solve the problem in an async fashion with a single thread,
you get the same or better performance (in python, at least, in my
experience) without having to go through all sorts of "what if"
scenarios in your head, since you know python is only doing one thing
at any particular time without being interrupted. With all the shared
objects between threads, it makes it tempting to dangerous things.
-bob
More information about the Pythonmac-SIG
mailing list