[New-bugs-announce] [issue34458] No way to alternate options

Victor Porton report at bugs.python.org
Tue Aug 21 20:13:51 EDT 2018


New submission from Victor Porton <porton at narod.ru>:

I have:

parser.add_argument('-p', '--preload', help='preload asset', action='append', metavar='NAMESPACE')

I want also add:

parser.add_argument('-f', '--file', help='preload file', action='append', metavar='FILE', dest='preload')

This way I could specify -p and/or -f options in any order (like: first -p then -f then -p again) and store then in 'preload' field in the order which the user specified the options.

But I have no way to know if an option is -p or -f :-(

Please add something to argparse to solve this problem.

----------
components: Library (Lib)
messages: 323857
nosy: porton
priority: normal
severity: normal
status: open
title: No way to alternate options
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34458>
_______________________________________


More information about the New-bugs-announce mailing list