Add Virtual Threads to Python

This sounds like a good idea, but would still require a separate set of e.g. networking stdlib modules or implementations, right ?

It reminds me a lot of the gevent library I used years ago, which also implements a coroutine based approach for networking, building on the low level greenlets, which Armin and Christian created a longer while ago (based on work Christian had done with Stackless).

The downside with gevent is that it requires replacing stdlib implementations with new ones supporting the greenlet approach.

If your suggestion can overcome this, it’d be a really good idea.

Also: Could you comment on how C extensions would be able to play nicely with these Continuations ?

The nice thing about greenlets is that they support stack context switches with C functions on the stack, which makes them very versatile when dealing with e.g. callbacks.

10 Likes