[issue14116] Lock.__enter__() method returns True instead of self

sbt report at bugs.python.org
Sun Feb 26 16:39:56 CET 2012


sbt <shibturn at gmail.com> added the comment:

> IIUC returning True is not incorrect, only useless.  In the stdlib I 
> usually see “with lock:”.  Can you tell what is the use case for 
> accessing the condition object inside the context block?  Does it 
> apply only to Condition or also to *Lock and Semaphore?

I was going to do something like

  with Condition() as c:
    Thread(target=foo, args=(c,...)).start()
    c.wait_for(...)

But I will agree that I don't have a compelling use case.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14116>
_______________________________________


More information about the Python-bugs-list mailing list