On Fri, Sep 26, 2014 at 1:40 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > Fair enough. In the simple example above, I see no harm in simply > moving the add_done_callback call outside (after) the "with self.lock" > block altogether. I can imagine more complex examples where the call > is further down the stack and harder to isolate from the lock, > although I would argue that's probably a code smell.
I'd definitely call it code smell. What happens with this? with lock: def inner(): do_more_work() f.add_done_callback(inner) The lock's possibly released before the callback happens, or possibly not, but either way, the code *looks* as if it's all happening inside the "with lock" block. Recipe for confusion IMO. ChrisA -- https://mail.python.org/mailman/listinfo/python-list