socket function that loops AND returns something
Cameron Laird
claird at lairds.us
Thu Sep 16 08:08:04 EDT 2004
In article <tpc2d.16169$QJ3.2672 at newssvr21.news.prodigy.com>,
Bryan Olson <fakeaddress at nowhere.org> wrote:
.
.
.
>I'd classify the ways to do it somewhat differently than the
>other responses:
>
> -Start multiple lines of execution
> - using threads
> - using processes (which, in Python, is less portable)
>
> -Wait for action on multiple sockets within a single thread
> - using os.select
> - using some less-portable asynchronous I/O facility
>
>Those are the low-level choices. Higher level facilities, such
>as Asyncore and Twisted, are themselves based on one or more of
>those.
>
>Different servers have different needs, but when in doubt use
>threads. Threading on the popular operating systems has
>improved vastly in the last several years. Running a thousand
>simultaneous threads is perfectly reasonable. Programmers using
>threads have to be aware of things like race conditions, but
>when threads are handling separate connections, most of their
>operations are independent of other threads.
.
.
.
Are you advising Python programmers to use only thread-based
approaches, and to judge Asyncore and Twisted on that basis?
Do you intend that readers believe that it "is perfectly
reasonable" to design in terms of a single Python process
which manages up to "a thousand simultaneous *Python* threads"?
More information about the Python-list
mailing list