GIL detector

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Aug 17 12:43:50 EDT 2014


Joseph L. Casale wrote:

>> I don't have to care about threading issues all the time and
>> can otherwise freely choose the right model of parallelism that suits my
>> current use case when the need arises (and threads are rarely the right
>> model). I'm sure that's not just me.
> 
> The sound bite of a loyal Python coder:)

Who are you replying to? Please give attribution when you quote someone.


> If it weren't for these "useless" threads, you wouldn't have even been
> able to send that message, let alone do anything on a computer for that
> matter.

I don't see anyone except you calling threads "useless". That's your word.
The person you quoted said that threads are "rarely" the right module,
which is not the same. (And probably a bit strong.)

However, you are factually wrong. Computers existed for decades before
lightweight threads were invented. Computers were capable of networking and
messaging decades ago, before the Internet existed, and they did it without
threads, supporting hundreds or even thousands of users at a time. They did
it with multiple processes, not threads, and today we have the same choice.

There are pros and cons to both multithreading and multiprocessing. Those
who insist that Python is completely broken because some implementations
cannot take advantage of multiple cores from threads have missed the point
that you can use a separate process for each core instead.

Ironically, using threads for email in Python is probably going to work
quite well, since it is limited by I/O and not CPU.


-- 
Steven




More information about the Python-list mailing list