Andreas Kostyrka wrote: > * Kent Johnson <[EMAIL PROTECTED]> [070414 19:53]: >> That's a good point. Does anyone know when to prefer threading.local() >> vs thread attributes? > It's design question, I guess: > > *) if you have thread subclasses, then use thread attributes. > *) if you have standard threads, then use thread.local(). > > The idea is, that it's "rude" to stick attributes on an object that is > not owned by you. > > Rationale: > *) Somebody might decide to make threading.Thread be a new style > object with __slots__ => your code breaks. > > I know, it's unprobably, but if you derive a subclass, you can be at > least sure that the object will have a __dict__ ;)
If you use threading.local() you can be sure the names you use don't conflict with any attributes of the thread. Kent _______________________________________________ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor