Skip to content
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

argparse docs: normalize constant references #98765

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Name Description
action_ Specify how an argument should be handled ``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, ``'append_const'``, ``'count'``, ``'help'``, ``'version'``
choices_ Limit values to a specific set of choices ``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` instance
const_ Store a constant value
default_ Default value used when an argument is not provided Defaults to *None*
default_ Default value used when an argument is not provided Defaults to ``None``
dest_ Specify the attribute name used in the result namespace
help_ Help message for an argument
metavar_ Alternate display name for the argument as shown in help
Expand Down Expand Up @@ -201,9 +201,10 @@ ArgumentParser objects
* usage_ - The string describing the program usage (default: generated from
arguments added to parser)

* description_ - Text to display before the argument help (default: none)
* description_ - Text to display before the argument help
(by default, no text)

* epilog_ - Text to display after the argument help (default: none)
* epilog_ - Text to display after the argument help (by default, no text)

* parents_ - A list of :class:`ArgumentParser` objects whose arguments should
also be included
Expand Down Expand Up @@ -1926,8 +1927,8 @@ FileType objects
Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, raw=<_io.FileIO name='raw.dat' mode='wb'>)

FileType objects understand the pseudo-argument ``'-'`` and automatically
convert this into ``sys.stdin`` for readable :class:`FileType` objects and
``sys.stdout`` for writable :class:`FileType` objects::
convert this into :data:`sys.stdin` for readable :class:`FileType` objects and
:data:`sys.stdout` for writable :class:`FileType` objects::

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('infile', type=argparse.FileType('r'))
Expand Down