Skip to content

bpo-21150: Add summary of argparse #1210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

bpo-21150: Add summary of argparse #1210

wants to merge 1 commit into from

Conversation

louisom
Copy link
Contributor

@louisom louisom commented Apr 20, 2017

No description provided.

@mention-bot
Copy link

@lulouie, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benjaminp, @birkenfeld and @ezio-melotti to be potential reviewers.

@louisom louisom changed the title bpoAdd summary of argparse bpo-21150: Add summary of argparse Apr 20, 2017
@rhettinger rhettinger self-assigned this Apr 26, 2017
^^^^^^^^^^^^^

.. csv-table::
:header: "Name", "Common Used Arguments", "Example"
Copy link
Member

Choose a reason for hiding this comment

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

Commonly*


":class:`argparse.ArgumentParser`", "`prog`_, `description`_, `formatter_class`_", "``parser = argparse.ArgumentParser(prog='PROG', description='DESC', formatter_class=argparse.RawDescriptionHelpFormatter)``"
":func:`ArgumentParser.add_argument`", "`name or flags`_, `action`_, `default`_, `type`_, `required`_, `help`_", "``parser.add_argument('-v', '--verbose', action='store_true', help='Show various debugging information')``"

Copy link
Member

Choose a reason for hiding this comment

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

Why not have two small code blocks rather than a table here?

Copy link
Member

Choose a reason for hiding this comment

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

With a code block it is not possible to link to the individual args, but I'm not sure that's really necessary since there are already links in one of the following tables.

@@ -185,6 +240,8 @@ ArgumentParser objects
The following sections describe how each of these are used.


.. _prog:

prog
^^^^
Copy link
Member

Choose a reason for hiding this comment

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

I think the target markup is not necessary. The headings are automatically targets, but the markup to create the link is different (if I remember right):

`:ref:`prog`

`const`_ The constant values of name or flags
`choices`_ Arguments should selected from this set or values ``['foo', 'bar']``, ``range(1, 10)``, Any object that support ``in`` operator
`required`_ Indicate a optional argument is required or not ``True``, ``False``
`metavar`_ A alternative display name for argument
Copy link
Member

Choose a reason for hiding this comment

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

s/A/An/

====================== ================================================== =======================================================================================================================
Name Description Keywords
====================== ================================================== =======================================================================================================================
`nargs`_ Associates number of arguments ``N`` (an integer), ``'?'``, ``'*'``, ``'+'``, ``argparse.REMAINDER``
Copy link
Member

Choose a reason for hiding this comment

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

This description is not particularly clear.

You should also decide if you want to use 2nd or 3rd person and do it consistently (e.g. this is 3rd, but then you have "indicate" which is 2nd/imperative).

You could use :class:`int` instead of integer.

`nargs`_ Associates number of arguments ``N`` (an integer), ``'?'``, ``'*'``, ``'+'``, ``argparse.REMAINDER``
`const`_ The constant values of name or flags
`choices`_ Arguments should selected from this set or values ``['foo', 'bar']``, ``range(1, 10)``, Any object that support ``in`` operator
`required`_ Indicate a optional argument is required or not ``True``, ``False``
Copy link
Member

Choose a reason for hiding this comment

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

s/a /an /

====================== =============================================== =========================================================================================================================
Name Description Keywords
====================== =============================================== =========================================================================================================================
`action`_ What to do on arguments ``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, ``append_const``, ``count``, ``help``, ``version``
Copy link
Member

Choose a reason for hiding this comment

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

Maybe s/on/with the/?

The last few values are missing the quotes.

`action`_ What to do on arguments ``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, ``append_const``, ``count``, ``help``, ``version``
`default`_ Default value of arguments
`type`_ Treat arguments as type ``int``, ``float``, ``bool``, ``argparse.FileType('w')``, ``callable function``
`help`_ Help message of arguments
Copy link
Member

Choose a reason for hiding this comment

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

I would use singular "argument" throughout the table, since add_argument and its options only affect a single argument.

Summary
-------

Core function
Copy link
Member

Choose a reason for hiding this comment

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

s/function/functions/ ?

Also ArgumentParser is a class, not a function.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe «Core functionality» was meant.


":class:`argparse.ArgumentParser`", "`prog`_, `description`_, `formatter_class`_", "``parser = argparse.ArgumentParser(prog='PROG', description='DESC', formatter_class=argparse.RawDescriptionHelpFormatter)``"
":func:`ArgumentParser.add_argument`", "`name or flags`_, `action`_, `default`_, `type`_, `required`_, `help`_", "``parser.add_argument('-v', '--verbose', action='store_true', help='Show various debugging information')``"

Copy link
Member

Choose a reason for hiding this comment

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

With a code block it is not possible to link to the individual args, but I'm not sure that's really necessary since there are already links in one of the following tables.

====================== =============================================== =========================================================================================================================
`action`_ What to do on arguments ``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, ``append_const``, ``count``, ``help``, ``version``
`default`_ Default value of arguments
`type`_ Treat arguments as type ``int``, ``float``, ``bool``, ``argparse.FileType('w')``, ``callable function``
Copy link
Member

Choose a reason for hiding this comment

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

"Automatically converts the argument to the given type"

Name Description Keywords
====================== ================================================== =======================================================================================================================
`nargs`_ Associates number of arguments ``N`` (an integer), ``'?'``, ``'*'``, ``'+'``, ``argparse.REMAINDER``
`const`_ The constant values of name or flags
Copy link
Member

Choose a reason for hiding this comment

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

This is also not particularly clear.

====================== ================================================== =======================================================================================================================
`nargs`_ Associates number of arguments ``N`` (an integer), ``'?'``, ``'*'``, ``'+'``, ``argparse.REMAINDER``
`const`_ The constant values of name or flags
`choices`_ Arguments should selected from this set or values ``['foo', 'bar']``, ``range(1, 10)``, Any object that support ``in`` operator
Copy link
Member

Choose a reason for hiding this comment

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

"A container that lists the possible values"

(container could link to the glossary entry if there is one)

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@flavianh
Copy link

@merwok @ezio-melotti What's the status on this?

@merwok
Copy link
Member

merwok commented Jul 29, 2019

Review comments haven’t been addressed

@flavianh
Copy link

@merwok I'm not sure they will ever be addressed, @louisom 's repository is now marked unknown. We could either close this PR, or if you think it still has value I could take over for @louisom

@rhettinger
Copy link
Contributor

I think the current state of the patch is hopeless. If some one is inclined to take a more professional pass at this, I think they would be better off starting from scratch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting changes docs Documentation in the Doc dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants