Hacker News new | ask | show | jobs
by japaget 4697 days ago
The article is from 2008, so it applies to Python 2. I don't know enough about threading to say whether the same code will work in Python 3.
2 comments

It will. If you just tweak some things in the examples like urllib2 imports and print-as-a-statement usage, the threading API is the same so it's still generally relevant.
it probably predates the multiprocessing package (introduced in 2.6, october 2008, although available 3rd party before that) and certainly doesn't mention it.

multiprocessing does use multiple cores, but is a heavyweight solution (separate, communicating processes, wrapped in a thread-like api). if you need multiple threads for cpu-related performance, it can be very useful.

python 2.6+, including 3.

http://toastdriven.com/blog/2008/nov/11/brief-introduction-m...

http://docs.python.org/2/library/multiprocessing.html