25
submitted 2 months ago by Qutorial@lemmy.world to c/python@lemmy.world

Python will get true threading support with the removal of the GIL (Global Interpreter Lock) in 3.13 (now available in the beta as an experimental option).

The GIL has long crippled Python's threading capabilities, but will be getting true parallelism with the implementation of PEP 703.

What are you gonna do with real threads? 🤔

top 4 comments
sorted by: hot top controversial new old
[-] pelya@lemmy.world 2 points 2 months ago

The same exact thing I do with multiprocess Python, I'm not going to update all of my code.

Multiprocess approach is arguably more robust, you can't corrupt memory from another thread, because the only point of interaction you have with your other rpocesses is queue and semaphore.

[-] Qutorial@lemmy.world 3 points 2 months ago

But with multiprocessing you're paying extra cycles to serialize and deserialize with those data structures (plus the added cost of storing copies in multiple places), and processes are much heavier to spin up...

[-] pelya@lemmy.world 1 points 2 months ago

Yeah, there is overhead. It's not so critical for Python, because I am using it for scripting and prototyping, and when I need performance, I rewrite critical code parts in C++.

[-] fubarx@lemmy.ml 1 points 2 months ago

Just downloaded the free-threading RC version via pyenv. Looking forward to taking it for a spin.

this post was submitted on 10 Aug 2024
25 points (100.0% liked)

Python

148 readers
1 users here now

A community for discussing the Python programming language.

https://www.python.org/

founded 1 year ago
MODERATORS