On Fri, Nov 3, 2017 at 3:27 AM, Israel Brewster <isr...@ravnalaska.net> wrote:
>
> Actually, that saying is about regular expressions, not threads :-) . In the 
> end, threads are as good a way as handling concurrency as any other, and 
> simpler than many. They have their drawbacks, of course, mainly in the area 
> of overhead, and of course only multiprocessing can *really* take advantage 
> of multiple cores/CPU's on a machine, but unlike regular expressions, threads 
> aren't ugly or complicated. Only the details of dealing with concurrency make 
> things complicated, and you'll have to deal with that in *any* concurrency 
> model.
>

Thank you. I've had this argument with many people, smart people (like
Steven), people who haven't grokked that all concurrency has costs -
that threads aren't magically more dangerous than other options. They
have a few limitations (for instance, you can't viably have more than
a few thousand threads in a process, but you could easily have orders
of magnitude more open sockets managed by asyncio), but for many
situations, they're the perfect representation of program logic.
They're also easy to explain, and then other concurrency models can be
explained in terms of threads (eg async functions are like threads but
they only switch from thread to thread at an 'await' point).

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to