Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I see this sentiment everywhere. Processes don't solve every problem, nor do threads, and nor do fibers. They're each useful in different places.

Despite the GIL, threads are still useful in Python for handling asynchronous operations. One or more threads pull items off a work queue, process them, and then put the results somewhere else. The GIL is a problem only when operations are CPU-bound, but Python is pretty damn slow at that anyway. Alternatively, you can sidestep the GIL by creating a thread in a C extension that does the heavy-lifting, then calls back into Python with the result.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: