Skip to content

gh-42765 timeit.Timer Documentation Update - #108744

Closed
richardhob wants to merge 9995 commits into
python:mainfrom
richardhob:gh42765-timit-execution-environment
Closed

richardhob wants to merge 9995 commits into
python:mainfrom
richardhob:gh42765-timit-execution-environment

Conversation

@richardhob

@richardhob richardhob commented Sep 1, 2023 •

Copy link
Copy Markdown
Contributor

Update the timeit documentation based on discussion in issue #42765.

Resolve Issue #42765

This issue discusses the documentation for the timeit.Timer class, as well as possible improvements. elibendersky provided a patch to update the documentation, and rurpy improved on this in a post. This merge request implements rurpy's version of the timeit.Timer class documentation with some light edits.

The goal of this documentation change is to better explain how to use timeit.Timer, what the input arguments are, and how the args are use to actually time the execution of the provided snippet.


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

@bedevere-bot bedevere-bot added the docs Documentation in the Doc dir label Sep 1, 2023
@erlend-aasland

ghost commented Jan 23, 2024

Copy link
Copy Markdown
Contributor

@richardhob, can you please split this up: create a PR with the low-hanging fruit first, and then, if possible, create one PR for rewording the class docs, and one for rewording the method docs.

Doc PRs that change multiple things at once are hard to review, and rarely get attention.

Petr Viktorin and others added 26 commits September 8, 2025 12:02
…hlevel.h (pythonGH-138545)

Move PYTHON_API_VERSION & PYTHON_ABI_VERSION to patchlevel.h

This allows removing #include "modsupport.h" from python_ver_rc.h,
which allows modsupport.h to use common helpers from Python.h --
specifically, `_Py_PACK_VERSION` for defining limited API.
…684 (python#138651)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
docs(gc): fix typo in get_threshold() docstring

Removes a duplicate "the" from the docstring for the `gc.get_threshold()` function.
This makes information about the interpreter ABI more accessible.

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
… produced the val… (python#138678)

Opcodes which consume no inputs should indicate they produced the value, not an arbitrary local
python#138649)

Adds a --no-randomize option to the CI runner, so that randomisation can be easily
disabled for --fast-ci and --slow-ci configurations on single-threaded testing platforms
like Android, iOS, and Emscripten.

---------

Co-authored-by: Malcolm Smith <smith@chaquo.com>
…8537)

While file timestamps can be anything the file system can store, most
lie between the recent past and the near future.  Optimize fill_time()
for typical timestamps in three ways:

- When possible, convert to nanoseconds with C arithmetic.
- When using C arithmetic and the seconds member is not required (for
  st_birthtime), avoid creating a long object.
- When using C arithmetic, reorder the code to avoid the null checks
  implied in Py_XDECREF().

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com>
…s(echo_char=...)` (python#138677)

In bf8bbe9, `getpass.getpass` gained
the ability to provide keyboard feedback through `echo_char`.

On Unix, line editing shortcuts such as Ctrl+U were previously handled
as the terminal operates in canonical mode (see termios(3)). However,
since keyboard feedback requires to switch to noncanonical mode, this
now results in an inconsistency when `getpass.getpass` uses `echo_char`
as those shortcuts are no more supported. This limitation is specific
to Unix and does not affect Windows users where line editing shortcuts
were never supported.
…38698)

Follow-up refactoring after pythonGH-133143, where we use `_Py_ID` for "big" and "little"
in `abi_info.byteorder`.
This uses `_Py_ID` for `sys.byteorder`, but also `float_repr_style` and a module name.
)

Pass directly the module state instead of passing the module to avoid
a call to get_posix_state().
…H-137167)

The codecs lookup function now performs only minimal normalization of
the encoding name before passing it to the search functions:
all ASCII letters are converted to lower case, spaces are replaced
with hyphens.

Excessive normalization broke third-party codecs providers, like
python-iconv.

Revert "bpo-37751: Fix codecs.lookup() normalization (pythonGH-15092)"

This reverts commit 20f59fe.
@python-cla-bot

ghost commented Sep 24, 2025

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

@AlexWaygood
AlexWaygood removed their request for review September 24, 2025 14:59
@StanFromIreland

ghost commented Sep 24, 2025

Copy link
Copy Markdown
Member

That force push was broken (maybe you merged 3.14 in?) and resulted in a large number of review requests, please create a new PR.

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

Labels

awaiting core review docs Documentation in the Doc dir stale Stale PR or inactive for long period of time.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.