Marko Rauhamaa <ma...@pacujo.net> writes: > - Thread programming assumes each thread is waiting for precisely > one external stimulus in any given state -- in practice, each > state must be prepared to handle quite a few possible stimuli.
Eh? Threads typically have their own event loop dispatching various kinds of stimuli. > - Thread-safe programming is easy to explain but devilishly > difficult to get right. I keep hearing that but not encountering it. Yes there are classic hazards from sharing mutable state between threads. However, it's generally not too difficult to program in a style that avoids such sharing. Have threads communicate by message passing with immutable data in the messages, and things tend to work pretty straightforwardly. > Asyncio makes the prototype somewhat cumbersome to write. However, > once it is done, adding features, stimuli and states is a routine > matter. Having dealt with some node.js programs and the nest of callbacks they morph into as the application gets more complicated, threads have their advantages. -- https://mail.python.org/mailman/listinfo/python-list