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

2018-02-03 Thread Benjamin Peterson


On Sat, Feb 3, 2018, at 11:25, Gregory P. Smith wrote:
> On Wed, Jan 31, 2018 at 4:46 PM Jesus Cea  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.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-02-03 Thread Gregory P. Smith
On Wed, Jan 31, 2018 at 4:46 PM Jesus Cea  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.  Always feel free to make a
documentation update PR.

The method does have a docstring.
  https://github.com/python/cpython/blob/master/Modules/_threadmodule.c#L193

-gps


>
> (I didn't investigate other objects in the module).
>
> --
> Jesús Cea Avión _/_/  _/_/_/_/_/_/
> j...@jcea.es - http://www.jcea.es/ _/_/_/_/  _/_/_/_/  _/_/
> Twitter: @jcea_/_/_/_/  _/_/_/_/_/
> jabber / xmpp:j...@jabber.org  _/_/  _/_/_/_/  _/_/  _/_/
> "Things are not so easy"  _/_/  _/_/_/_/  _/_/_/_/  _/_/
> "My name is Dump, Core Dump"   _/_/_/_/_/_/  _/_/  _/_/
> "El amor es poner tu felicidad en la felicidad de otro" - Leibniz
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/greg%40krypto.org
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-01-31 Thread Jesus Cea
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?.

(I didn't investigate other objects in the module).

-- 
Jesús Cea Avión _/_/  _/_/_/_/_/_/
j...@jcea.es - http://www.jcea.es/ _/_/_/_/  _/_/_/_/  _/_/
Twitter: @jcea_/_/_/_/  _/_/_/_/_/
jabber / xmpp:j...@jabber.org  _/_/  _/_/_/_/  _/_/  _/_/
"Things are not so easy"  _/_/  _/_/_/_/  _/_/_/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/_/_/_/  _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz



signature.asc
Description: OpenPGP digital signature
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com