2 ms·
If you mean lock-free as in no GIL, you obviously can't. But otherwise all python code is inherently thread safe.
by ben-schaaf 8y ago
If you mean lock-free as in no GIL, you obviously can't. But otherwise all python code is inherently thread safe.
- meddlepal 8y agoYea I meant lock free and ready for multi-threaded use without a GIL. I didn't mean to dump on Python either, I write a lot of Python and Java but comparisons like yours aren't really fair because the JVM is just considerably more powerful than Python's runtime. I could take a huge list of words, hand subsets to threads and let them all update the same map using the same API and without needing a lock.