7 ms·
Why can't Python have something like http://libmill.org http://libmill.org ? If it's doable in C, why not in Python?
by rumcajz 10y ago
Why can't Python have something like http://libmill.org http://libmill.org ?
If it's doable in C, why not in Python?
- gigatexal 10y agoWhoa thanks for this, definitely going to check it out.
- rdtsc 10y agoIt has those. It as the greenlet library and used by eventlet and gevent. Many use those, and they've been there for many years. But Guido and others decided that is not acceptable. So we've gone the Twisted route (because everyone know Twisted is easy and fun) and now we have yields, co-routines, futures, awaits and all the other mess.
- WaxProlix 10y agoLots of conversation between Armin and a few others about these approaches in reddit's /r/python thread for this article. I happen to think that gevent got a ton right, and the consensus seems to be that this 'new' approach is sort of half-baked, at least vis-a-vis python implementation. https://www.reddit.com/r/Python/comments/5a6gmv/i_dont_understand_pythons_asyncio_armin_ronachers/ https://www.reddit.com/r/Python/comments/5a6gmv/i_dont_under...
- sadgit 10y agoTotally agree. Its a damn shame, too, it fit so elegantly into a programming style that looked very analgous to the threading library. Look at Tornado's StackContext to see the kind of mess that callpack passing creates. Its a gc nightmare.
- mzs 10y agohttp://libmill.org/documentation.html http://libmill.org/documentation.html Libmill runs in following environments: Microarchitecture: x86_64, ARM Compiler: gcc, clang Operating system: Linux, OSX, FreeBSD, OpenBSD, NetBSD, DragonFlyBSD Whether it works in different environments is not known - please, do report any successes or failures to the project mailing list.
- danappelxx 10y agoHe was not suggesting to adopt libmill, only to adopt a similar concurrency scheme.
- mzs 10y agoI wasn't saying that either, I was saying libmill did not do it in (pure) C: https://github.com/sustrik/libmill/blob/master/libmill.h https://github.com/sustrik/libmill/blob/master/libmill.h It only works with gcc and clang now, no longer with windows, and is sprinkled with asm()s. That doesn't fly with the CPython is portable. I don't know how these go-like features could be created with ANSI C, but I'd love to be proven wrong.
- afrancis 10y agoAlthough I am not aware of any recent development, you should look at Stackless Python which was inspired by Limbo. Stackless Python has lightweight threads (stacklets) and synchronous channels a la various Bell labs family of languages (include Go). The greenlets that Gevent uses comes from Stackless.
- webmaven 10y agoHow does Stackless CPython[1] compare with Stackless PyPy[2]? [1] http://www.stackless.com/ http://www.stackless.com/ [2] http://doc.pypy.org/en/latest/stackless.html http://doc.pypy.org/en/latest/stackless.html
- afrancis 10y agoAlthough I have used both CPython and Stackless.py, the specific differences are fading from my memory. While working on a Go style select() for stackless.py I recall there were minor differences in how the runnable list is represented and accessed. However this is really an implementation detail. For the most part, they are pretty much the same. The biggest difference I remember in the current stackless.py implementation, the move to "continuelets" resulted in the inability to pickle "complex" stackless tasklets. So it becomes more difficult to stop a tasklet in one thread and restart it in another. Maybe the ability to control the recursion depth (including getting rid of it) may also be gone in stackless.py.