This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: threading.Timer is not a class
Type: Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: docs@python Nosy List: angad, docs@python, jrunyon, ned.deily, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-05-21 06:29 by jrunyon, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
function_threading_timer.diff angad, 2015-07-04 08:58 review
timer.diff jrunyon, 2015-11-17 12:02
Messages (7)
msg243735 - (view) Author: John Runyon (jrunyon) * Date: 2015-05-21 06:29
the documentation (https://docs.python.org/2/library/threading.html#threading.Timer) lists "threading.Timer" as a class. It is not, which means that (for example) you can not use it in isinstance(). "threading._Timer" is a class. "threading.Timer(...).__class__" is a class. "threading.Timer" is a function.

>>> import threading
>>> threading.Timer
<function Timer at 0x7f99cae23848>
msg243736 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-05-21 06:44
This is really a duplicate of Issue5831 which ended up being closed as a duplicate of Issue10968.  The resolution of the latter issue was to change threading.Timer in Python 3.3 to actually be a class, a new feature.  But it appears that along the way the issue of correcting the documentation for 2.7 was never addressed.  Perhaps you could propose wording for a documentation patch?
msg243744 - (view) Author: John Runyon (jrunyon) * Date: 2015-05-21 10:54
Concise documentation isn't my forte, but my confusion would've been avoided with a note that "for historical reasons, threading.Timer is actually a factory function for the underlying class threading._Timer" or something along those lines.
msg246245 - (view) Author: Angad Singh (angad) * Date: 2015-07-04 08:58
Taking a stab at this. Attached patch.
msg246267 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-07-04 17:38
Thanks, but we don't want to document an "internal only" name (which is what the leading underscore means in this case).  It might be desirable to note that the name is a class in python3, I'm not sure.
msg254798 - (view) Author: John Runyon (jrunyon) * Date: 2015-11-17 12:02
New proposed patch.

I understand not wanting to document an "internal only name", except that in this case it rather needs to be documented. I would strongly prefer Angad's patch to mine because you do, at times, need to know the actual name of the class being used -- and the documentation should not force people to dig through the source code to find that.
msg370442 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-05-31 13:22
Python 2.7 is no longer supported.
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68444
2020-05-31 13:22:52serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg370442

resolution: out of date
stage: needs patch -> resolved
2015-11-17 12:02:56jrunyonsetfiles: + timer.diff

messages: + msg254798
2015-07-04 17:38:52r.david.murraysetnosy: + r.david.murray
messages: + msg246267
2015-07-04 08:58:39angadsetfiles: + function_threading_timer.diff

nosy: + angad
messages: + msg246245

keywords: + patch
2015-05-21 10:54:53jrunyonsetmessages: + msg243744
2015-05-21 06:44:41ned.deilysetnosy: + ned.deily

messages: + msg243736
stage: needs patch
2015-05-21 06:29:41jrunyoncreate