Nick Coghlan <ncogh...@gmail.com> added the comment: "with Lock() as lock:" doesn't make any sense - you need to share the lock with other threads or code for it be useful, which means you can't create it inline in the with statement header. Instead, you have to store it somewhere else (usually as a closure reference or a module, class or instance attribute) and then merely use it in the with statement to acquire and release it appropriately.
Absent a compelling use case, I'm inclined to reject this one - when there's no specifically useful value to return from __enter__, None, True or False are all reasonable alternatives. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14116> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com