2 ms·
> The problem is the threading solutions for python fill bolted on, and kind of break the whole "pythonic" feel of everything. See I find a lot Twisted, and yi
by rdtsc 14y ago
> The problem is the threading solutions for python fill bolted on, and kind of break the whole "pythonic" feel of everything.
See I find a lot Twisted, and yield based concurrency frameworks not being Pythonic enough. Threads are just functions that run concurrently. In the case of green threads it is really just as simple as spawn(func) to start a new green thread running function func().
Take a look at these eventlet examples, they are pretty elegant:
http://eventlet.net/doc/examples.html http://eventlet.net/doc/examples.html
Yes there is monkey patching. However, that happens once per program at the very top. That is a small price to pay for the ability to use all the Python libraries out there.
Speaking of libraries. That is one good thing about Python. And probably the reason to stick to it -- the large library ecosystem. Of course it depends on the system you are designing but a large enough system will usually need some other libraries (parsing a protocol, using a work queue etc).
Go and Erlang also have plenty, but not nearly the level and breadth that Python has.
- codygman 14y agoThis is a fair solution, and I believe that gevent was the best solution IMO for python although I only gave it a cursory glance. However, type checking is what ultimatley won out here along with Go's very C+Python love child feeling.