Paul Rubin wrote: > Bjoern Schliessmann <[EMAIL PROTECTED]> >> (Why does everyone think that "concurrency" equals "usage of >> multiple threads"?) > > Well, it doesn't necessarily, but that's easiest a lot of the > time.
I don't think so. Personally, I like multiplexing better. I think it has less complex code. >> Try Twisted for your networking needs. > > I should try to understand Twisted better one of these days, but > it's much more confusing than threads. Sure? I don't think so. I once tried using threads and quickly had more code for threading than for my functionality, and even had problems, e. g. with synchronisation or shutting down properly. IMHO, Twisted is easier, like most multiplexing techniques: Just write your code (derived from existing client or server classes) and hook it up to the reactor, and the rest works automagically. (You can even hook your protocol to stdin/stdout or install a "manhole" in the server. You also have twistd which does all the daemon and logging work for you. Yes, I'm biased ;) ) > Also, the function I want to parallelize does blocking operations > (database lookups), so in Twisted I'd have to figure out some way > to do them asynchronously. Twisted _is_ asynchronous networking. It also has database classes: http://twistedmatrix.com/documents/current/api/twisted.enterprise.html Regards, Björn -- BOFH excuse #292: We ran out of dial tone and we're and waiting for the phone company to deliver another bottle. -- http://mail.python.org/mailman/listinfo/python-list