GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — gh-80642: Correct the documented default for `Timer.autorange`'s `target_time` by Dhairya-007 · Pull Request #161509 · python/cpython Conversation
but the parameter does not default to # Lib/timeit.py default_target_time = 0.2 ... def autorange(self, callback=None, target_time=default_target_time):
The parameter is new in 3.15 (added in gh-80642 / GH-140283), so this has not been wrong for long. I used the concrete value rather than the constant name to match the neighbouring entries in the same file, which already do this: rather than naming Note on GH-144825GH-144825 also edits this directive, but only rewords the description body; it leaves the signature line unchanged, so there is no overlap with this one-line change. That PR does incidentally drop the stray Documentation only, so no NEWS entry.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsThe signature documented target_time=None, but the parameter defaults to default_target_time, which is 0.2. None is not a usable value: autorange compares time_taken >= target_time, which raises TypeError against None. Uses the concrete value, matching the neighbouring Timer.timeit and Timer.repeat entries, which document number=1000000 and repeat=5 rather than the default_number and default_repeat constants.
|
There was an error while loading. Please reload this page.
Documentation build overview
50 files changed ·
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Timer.autorange's target_timeTimer.autorange's target_time
Timer.autorange's target_timeTimer.autorange's target_time
There was an error while loading. Please reload this page.
Timer has no target_time attribute: target_time is a parameter of autorange(), defaulting to the module-level default_target_time. The next sentence already refers to it as *target_time*.
|
Good catch — it doesn't exist. Worth noting there is some overlap with #144825, which rewords this same paragraph (and happens to drop that line altogether). Happy to defer to it if you'd rather land that one first — this PR is just the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
We can first fix the typo and see what to do with the other PR later. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.