Skip to content

Conversation

miikka
Copy link

@miikka miikka commented Oct 18, 2025

This is an updated version of PR #12954 with latest main merged in. I also fixed a few issues in the original (it's now consistently called target_time, there was a float conversion missing, etc.).

To quote the original PR:

  • make the 0.2s time configurable;
  • have timeit and repeat methods (and functions) fall back on autorange if the number is set to 0 or None.

📚 Documentation preview 📚: https://cpython-previews--140283.org.readthedocs.build/

@python-cla-bot
Copy link

python-cla-bot bot commented Oct 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

miikka and others added 2 commits October 18, 2025 13:22
Co-authored-by: Hugo van Kemenade <[email protected]>
@picnixz
Copy link
Member

picnixz commented Oct 19, 2025

Previously timeit returned a single value. Now it can return a pair if number is 0. This should be better documented because it coule be breaking existing code (I do not know if 0 was a legit value beforehand). I do not think we should expose the handling of number=0 to the timeit method itself. Or if this is the case we should first determine the number by autorange and then pass it to timeit() for the "real" test.

I cannot comment on the PR because the mobile app is not working well so I am only commenting here, but please consider this as me requesting changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants