Unique thread ID

Christian Heimes lists at cheimes.de
Fri Jan 18 03:31:19 EST 2008


Benjamin wrote:
> Is there a way to obtain a unique ID for the current thread? I have an
> object that I need to store local thread data in, and I don't want to
> use threading.local because each thread might have multiple instances
> of my object.

threading.get_ident() but please use threading.local. Nobody is going to
stop you if you use a list or dict in threading.local.

Christian




More information about the Python-list mailing list