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

Python threads, aren't they just single threaded execution?!


Yes, they are concurrent but not parallel.


See other replies to the post you've replied to: threads in Python can be "parallel", if one of the threads releases the GIL. This can happen during calls to I/O, or more generally, any C call that decides to release the GIL. Most of the time, you're doing I/O anyways, so it suffices. If you're not (you're truly doing computation), then there is multiprocessing.


Yea - decent approach if you're doing a lot of IO but for computation you're limited by the GIL.


People don't seem to understand this. If you are doing lots of IO Python threads are fully performant and the GIL isn't an issue at all.




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

Search: