Skip to content

bpo-21150: Add summary of argparse - #1210

Closed
louisom wants to merge 1 commit into
python:masterfrom
louisom:argparse-summary
Closed

bpo-21150: Add summary of argparse#1210
louisom wants to merge 1 commit into
python:masterfrom
louisom:argparse-summary

Conversation

@louisom

@louisomlouisom commented Apr 20, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@mention-bot

Copy link
Copy Markdown

@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.

@louisomlouisom changed the title bpoAdd summary of argparsebpo-21150: Add summary of argparseApr 20, 2017
@rhettingerrhettinger self-assigned this Apr 26, 2017
^^^^^^^^^^^^^

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

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.

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
Copy Markdown
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
Copy Markdown
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.

.. _prog:

prog
^^^^

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.

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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

@merwok

Copy link
Copy Markdown
Member

Review comments haven’t been addressed

@flavianh

Copy link
Copy Markdown

@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
Copy Markdown
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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changesdocsDocumentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@louisom@mention-bot@bedevere-bot@flavianh@merwok@rhettinger@ezio-melotti@matrixise@the-knights-who-say-ni