-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Documentation of timeit.Timer.timeit
should mention that the return value depends on the timer
#105052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, the function docstring and doc page need update |
How about replacing
|
I suggest timeit doc
be expanded to
|
This sounds very clear to me. But since the module lets use any of
A bit wordy. Perhaps an example can be inserted in the main documentation? |
So,the update description:
Any good advice? |
I think a few examples are necessary to clear all bases. In addition to terryjreedy's idea:
And maybe just above cpython/Doc/library/timeit.rst Line 310 in cb4615f
one could insert an example of what pochmann pointed out:
The docstring could probably just say that the return value depends on the timer specified. |
Is there any progress on this issue? The linked pull does not seem to have been updated. |
I plan on choosing from among the alternatives tomorrow to update. |
I'm busy with new job recently,thx your work @terryjreedy |
The documentation hasn't been updated yet? I am not proficient with reST, but would be willing to give this a shot using the suggestions here and in #105060. |
I have edited the PR and will merge when CI passes. |
--------- Co-authored-by: Terry Jan Reedy <[email protected]>
--------- Co-authored-by: Terry Jan Reedy <[email protected]> (cherry picked from commit 7096a2b) Co-authored-by: R <[email protected]>
--------- Co-authored-by: Terry Jan Reedy <[email protected]> (cherry picked from commit 7096a2b) Co-authored-by: R <[email protected]>
…08535) --------- Co-authored-by: Terry Jan Reedy [email protected] Co-authored-by: R <[email protected]> (cherry picked from commit 7096a2b)
Documentation
At the moment, it is as follows.
cpython/Lib/timeit.py
Lines 164 to 169 in cb4615f
The return value may not always be a float measured in seconds. If a different
timer
function is used:then it is an integer measured in nanoseconds.
Not entirely sure how to document it unambiguously, but perhaps it can be reworded to say something like: '… as a number measured in the time unit returned by the
timer
argument of the constructor (by default: a float measured in seconds).' Or similar?Linked PRs
The text was updated successfully, but these errors were encountered: