Threading question

Jeff Epler jepler at unpythonic.net
Sun Feb 1 18:34:02 EST 2004


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.

Example:
	class MyThread(threading.Thread): pass
	clients = {}
	client['client1'] = MyThread(...)

Jeff




More information about the Python-list mailing list