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 

assignee: docs@python
components: Documentation
messages: 277060
nosy: barry, docs@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 <>
Python-bugs-list mailing list

Reply via email to