Skip to content

timeit hardcodes plural "secs" #148254

@StanFromIreland

Description

@StanFromIreland

Bug report

Bug description:

cpython/Lib/timeit.py

Lines 342 to 347 in 8687b9d

s = "" if number == 1 else "s"
print(
f"{number} loop{s} "
f"{theme.punctuation}-> "
f"{theme.timing}{time_taken:.{precision}g} secs{reset}"
)

This should instead account for the (unlikely) situation that time_taken == 1 sec, like we do for loops.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    easystdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions