FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-131178: Update help message for `timeit` CLI by donbarbos · Pull Request #131326 · python/cpython · GitHub

/ cpython Public

gh-131178: Update help message for timeit CLI - #131326

Merged
hugovk merged 3 commits into
python:mainfrom
donbarbos:issue-131178-timeit
Mar 30, 2025
Merged

gh-131178: Update help message for timeit CLI#131326
hugovk merged 3 commits into
python:mainfrom
donbarbos:issue-131178-timeit

Conversation

donbarbos commented Mar 16, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

I thought it was weird to have next end for the help message. The one who added test case also noticed this and commented it.
I didn't find where it could be useful and also unexpectedly, this is what it looks like when I run ./python -m timeit -h:

main branch PR branch

picnixz commented Mar 16, 2025

Copy link
Copy Markdown
Member

Is the % part of the output or is it your terminal emulator? I think it's fine to have an empty line at the end so that it's a bit easier to read but I don't have a strong opinion on it though.

StanFromIreland left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I wasn't sure if this was correct, so I checked some GNU help pages. Conclusion -- it seems to be.

I did however like the handy link to the online docs.

$ cat --help

...

GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
Full documentation <https://www.gnu.org/software/coreutils/cat>
or available locally via: info '(coreutils) cat invocation'

donbarbos commented Mar 16, 2025
edited
Loading

Copy link
Copy Markdown
Contributor Author

% appears if you set end=' ' as an argument to the print function (by default end='\n' but I changed to end='')

and the first empty line appears as it is in timeit.__doc__ (I removed it from doc string)

picnixz commented Mar 16, 2025

Copy link
Copy Markdown
Member

What I meant is that on your second screenshot:

There is no newline between the end of the help and the prompt. I think we need a new line, as we currently have (but without %)

Copy link
Copy Markdown
Contributor Author

got it. we can either remove end argument or leave empty line at the end of __doc__

hugovk commented Mar 28, 2025

Copy link
Copy Markdown
Member

Yeah, I can repro the percent on main (last alpha shown here):

argparse CLI help has a single blank line at the end:

And with this PR we get two blank lines:

If we remove this newline (that is, revert da4d71f) we get a single blank line:

Please can you revert da4d71f? Thanks!

Copy link
Copy Markdown
Contributor Author

argparse doesn't have empty lines. I think you have one empty line because of your environment theme (line with a blue triangle).

currently for main branch we get two empty lines for timeit I suggested removing both but @picnixz suggested leaving one so I put one back.

but i can remove the second one again

hugovk merged commit 55150a7 into python:main Mar 30, 2025

hugovk commented Mar 30, 2025

Copy link
Copy Markdown
Member

Thanks!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL