[Python-Dev] "threading.Lock().locked()" is not documented

Benjamin Peterson benjamin at python.org
Sat Feb 3 16:08:29 EST 2018



On Sat, Feb 3, 2018, at 11:25, Gregory P. Smith wrote:
> On Wed, Jan 31, 2018 at 4:46 PM Jesus Cea <jcea at jcea.es> wrote:
> 
> > https://docs.python.org/3.6/library/threading.html doesn't document
> > "threading.Lock().locked()", and it is something quite useful.
> >
> > In fact, it is used in "threading.py" itself. For instance, lines 109,
> > 985, 1289.
> >
> > Is there any reason to not document it?.
> >
> 
> No good reason.  It is a public method and part of the public API
> regardless of being documented or not.

While I agree about .locked's present publicness, use of locked predicates in concurrent programs is usually serious code smell. So, the documentation should come with a warning note.


More information about the Python-Dev mailing list