Which is why the original .acquire() ... .release() idiom was wrong, this would 
better express the intent:

try:
  lock.acquire()
  shared_container.append(...)
finally:
  lock.release()

But like everyone mentions, the with statement takes care of all that in a more 
readable and compact fashion.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to