On May 12, 11:40 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > - in __getitem__, does it release the lock after returning the item? > > Yes, it does. > > > - wouldn't it be better to use threading.RLock, mutex, ... instead? > > Better in what sense? Performance-wise? Semantically? Performance-wise, > the best thing would be to do > > safe_dict = dict > > because the builtin dict is already thread-safe unless user-defined > __hash__ or __eq__ methods get invoked (in which case the dictionary > still works correctly - it's only that it may get modified while > __hash__ or __eq__ is running). > > Semantically, it would be better to use a threading.RLock, if you > expect that __hash__ or __eq__ may access the dictionary recursively. > > Regards, > Martin
Thank you! -- http://mail.python.org/mailman/listinfo/python-list