This post originated from an RSS feed registered with Python Buzz
by Ian Bicking.
Original Post: Concurrency: looking for positive models
Feed Title: Ian Bicking
Feed URL: http://www.ianbicking.org/feeds/atom.xml
Feed Description: Thoughts on Python and Programming.
My recent post on Prothon got several comments about threading.
Which is odd, since I hadn't mentioned threading, and it really was
entirely off-topic. (OK, technically it related to Prothon's lack of
a Global Interpreter Lock, but I ignored that in my post because the
GIL bores me)
During PyCon Bruce Eckel talked a little bit about threads in his
speach. Not a lot -- it was incidental to the main topic. But it got
a strong reaction from people -- heckling from the crowd (good
spirited though it was), and I'm sure Bruce heard other reactions
after. Whenever someone asks how to use threads, there's always
someone else who says "don't".
Personally, my experience hasn't been so bad. There's been some
annoying problems, but frankly concurrency is hard, and a lot of the
problems have been due to concurrency issues that wouldn't be
magically solved by a different form of concurrency. And a lot of
people get things done with threads... isn't that the real test?
What I don't see is a practical alternative being presented in most
cases. That is, an alternative that is easy to use, reliable, and
doesn't require you to twist your mind around new ways of programming
(pun not intended... or maybe it is subconsciously?)
When people are getting stuff done using threads, it's not a very
convincing argument to tell them they are just wrong. And you can
take my blocking calls from my cold, dead hands! So what's the
realistic alternative? What's the example application that deals with
concurrency safely and pleasantly, with a manageable codebase that is
friendly to outsiders? I don't want to drink the Kool Aid, I just
want to get things done. For all those that feel the same, threads so
far have been the safe bet.
(Okay, I'll admit it, I wrote this while procrastinating on fixing
some threading bugs; oh irony!)