On 18 December 2011 19:52, RangerElf <gustavo.cord...@gmail.com> wrote:
> 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() > No - this is very bad. The lock must be acquired outside the try: - otherwise if an exception is thrown while acquiring, you will try to release a lock that you have not acquired. Which again is why using with is a much better option - you can't make this kind of mistake. Tim Delaney
-- http://mail.python.org/mailman/listinfo/python-list