- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
With so many threads being spun off, the shirt will soon fall apart.
Admin
I'm confused, doesn't python have proper libraries to parallelize tasks?
Admin
I'm not very comfortable with multi-threading. But isn't this a thing that
yield
is designed to help?Admin
I'm sure it does, but the problem here is almost certainly that the person writing the code didn't think about the requirement and just piled in, initially writing some simple code that didn't work, gradually augmenting it using the Darwinian process until it worked well enough to pass a few test cases. This is a pretty standard design methodology for multi-threaded code as far as I can see.
Admin
The purpose of generating an infinite number of threads is obvious: twisting them as strands, themselves to be twisted as a rope, itself to be knotted as a noose. Those thread are the symbol of despair! Avoid them, lest your sanity gets sacrificed to Codethulhu!
Admin
Even without threading this code doesn't make any sense.
Admin
@Tim I agree with your theory -- programmer is inexperienced or uncurious and does a random walk through the code space. It is possible to do lock-free handshaking, and there is a place for it. But (a) compilers can reorder instructions, (b) processors can perform out-of-order execution, and (c) lock-free code is harder to get right, so needs more planning and documentation.