Threading question

Cameron Laird claird at
Mon Feb 2 02:32:44 CET 2004

In article <mailman.1112.1075678446.12720.python-list at>,
Jeff Epler  <jepler at> wrote:
>On Sun, Feb 01, 2004 at 11:25:26PM +0100, Jos� Carlos wrote:
>> sorry.
>> I want assign a name to each thread.
>> I want when the server accept to client, the server add to  list the client
>> with a name, for example client1.
>> the name of thread will be the name assigned to each client.
>Use a dictionary.  Almost any object can be a dictionary key, and any
>object can be a dictionary value.
>	class MyThread(threading.Thread): pass
>	clients = {}
>	client['client1'] = MyThread(...)

All true.

HOWEVER, please be aware that you do NOT have to assign
a separate thread to each client in order to construct a
server which can handle multiple concurrent clients.
Several different concurrency models are possible for
network service; among them, thread-per-client has 
particular performance and development constraints.  If
you're willing to program at a higher level of abstrac-
tion, asyncore and Twisted provide two excellent
alternatives for sound design of a server.

Cameron Laird <claird at>

More information about the Python-list mailing list