[New-bugs-announce] [issue28219] Is order of argparse --help output officially defined?

Barry A. Warsaw report at bugs.python.org
Tue Sep 20 15:53:07 EDT 2016

New submission from Barry A. Warsaw:

Sometimes we want to control the order of arguments printed by an argparse defined cli.  In practice, arguments are printed in the order in which they are added via add_argument(), but I don't think this is documented and thus should be considered an implementation detail.  It should be possible to enforce an order by the use of a formatter_class, but you'd probably need some extra metadata on arguments to do this, so it's not completely obvious how to write such a formatter class.

Instead, I propose to document and officially support that the order of add_argument() calls defines the order in which arguments are printed via --help.

assignee: docs at python
components: Documentation
messages: 277060
nosy: barry, docs at python
priority: normal
severity: normal
status: open
title: Is order of argparse --help output officially defined?
versions: Python 3.5, Python 3.6, Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list