# \#argparse

**URL:** https://discuss.python.org/tag/argparse/83.md

[Latest](https://discuss.python.org/latest.md) · [Categories](https://discuss.python.org/categories.md) · [Tags](https://discuss.python.org/tags.md)

---

## [Getting argparse to manage arguments with multiple names?](https://discuss.python.org/t/getting-argparse-to-manage-arguments-with-multiple-names/109557)

<div class="topic-metadata">

**Author:** [@HippoMan](https://discuss.python.org/u/HippoMan)\
**Replies:** 13\
**Last updated:** [November 19, 2026, 1:52am UTC](https://discuss.python.org/t/getting-argparse-to-manage-arguments-with-multiple-names/109557 "2026-11-19T01:52:23Z")

</div>

I’m running Python 3.15 under Debian linux version 13. This question refers only to the use of “argparse”, and it is not in any way meant to be any kind of “XY” question. If I can’t do what I describe here using argparse…

---

## [Add parameter \`validator\` to \`argparse.ArgumentParser.add\_argument\` or enhance \`argparse\` docs](https://discuss.python.org/t/add-parameter-validator-to-argparse-argumentparser-add-argument-or-enhance-argparse-docs/108573)

<div class="topic-metadata">

**Author:** [@bjhend](https://discuss.python.org/u/bjhend)\
**Replies:** 6\
**Last updated:** [August 15, 2026, 7:29pm UTC](https://discuss.python.org/t/add-parameter-validator-to-argparse-argumentparser-add-argument-or-enhance-argparse-docs/108573 "2026-08-15T19:29:12Z")

</div>

Note I made this proposal first as this issue, which was obviously the wrong way to go. Sorry for the extra noise. Problem Often only certain values are allowed for command line argument values. For example, you may hav…

---

## [Argparse ValueError: action store\_true is not valid for positional arguments](https://discuss.python.org/t/argparse-valueerror-action-store-true-is-not-valid-for-positional-arguments/106355)

<div class="topic-metadata">

**Author:** [@dsilva](https://discuss.python.org/u/dsilva)\
**Replies:** 2\
**Last updated:** [March 3, 2026, 3:49am UTC](https://discuss.python.org/t/argparse-valueerror-action-store-true-is-not-valid-for-positional-arguments/106355 "2026-03-03T03:49:51Z")

</div>

After upgrading to Python 3.14, my argparse code raises the following error: ValueError: action ‘store\_true‘ is not valid for positional arguments $ basketcase -h Traceback (most recent call last): File "/home/dsil…

---

## [Argparse: Multiple arguments with the same destination left-to-right order guarantee](https://discuss.python.org/t/argparse-multiple-arguments-with-the-same-destination-left-to-right-order-guarantee/105685)

<div class="topic-metadata">

**Author:** [@pdgendt](https://discuss.python.org/u/pdgendt)\
**Replies:** 12\
**Last updated:** [January 14, 2026, 10:12pm UTC](https://discuss.python.org/t/argparse-multiple-arguments-with-the-same-destination-left-to-right-order-guarantee/105685 "2026-01-14T22:12:45Z")

</div>

Reading the argparse docs, I didn’t find a formal guarantee that arguments are parsed from left-to-right, or “in order”, which is especially useful for a “last argument wins” approach when using the same destination. Fo…

---

## [Argparse: Allow the addition of instantiated parsers as subparsers](https://discuss.python.org/t/argparse-allow-the-addition-of-instantiated-parsers-as-subparsers/105198)

<div class="topic-metadata">

**Author:** [@rperezsoto](https://discuss.python.org/u/rperezsoto)\
**Replies:** 0\
**Last updated:** [December 4, 2025, 12:06pm UTC](https://discuss.python.org/t/argparse-allow-the-addition-of-instantiated-parsers-as-subparsers/105198 "2025-12-04T12:06:29Z")

</div>

Idea Add a new method append\_parser to argparse.\_SubParsersAction to allow the addition of already instantiated parsers as subparsers. Preferred Feedback Is this type of functionality, creating a command line parser fr…

---

## [Sort the action - parsers](https://discuss.python.org/t/sort-the-action-parsers/104578)

<div class="topic-metadata">

**Author:** [@AYA234](https://discuss.python.org/u/AYA234)\
**Replies:** 0\
**Last updated:** [October 27, 2025, 7:37pm UTC](https://discuss.python.org/t/sort-the-action-parsers/104578 "2025-10-27T19:37:08Z")

</div>

Using library: argparse I would like to sort my action parsers in the help menu (using a comparator or a lambda expression). Right now, I can achieve this by overriding the \_format\_action of argparse.HelpFormatter meth…

---

## [Argparse Parents vs Function for Common Arguments](https://discuss.python.org/t/argparse-parents-vs-function-for-common-arguments/104280)

<div class="topic-metadata">

**Author:** [@marsfan](https://discuss.python.org/u/marsfan)\
**Replies:** 2\
**Last updated:** [October 11, 2025, 2:24am UTC](https://discuss.python.org/t/argparse-parents-vs-function-for-common-arguments/104280 "2025-10-11T02:24:08Z")

</div>

When creating a new ArgumentParser there is a parents argument that can be used to add a set of additional arguments from a different parser, like so: from argparse import ArgumentParser base = ArgumentParser(add\_help=…

---

## [Add support for Environment Variables to argparse](https://discuss.python.org/t/add-support-for-environment-variables-to-argparse/103449)

<div class="topic-metadata">

**Author:** [@OOTS](https://discuss.python.org/u/OOTS)\
**Replies:** 1\
**Last updated:** [August 31, 2025, 12:25pm UTC](https://discuss.python.org/t/add-support-for-environment-variables-to-argparse/103449 "2025-08-31T12:25:05Z")

</div>

Hello, I’d like to (re-)open a discussion about adding support for environment variables to the argparse module in Python’s stdlib. Background: Nowadays it’s common for software to take arguments and configuration opt…

---

## [Argparse: Allow combining \`type\` and \`choices\`](https://discuss.python.org/t/argparse-allow-combining-type-and-choices/88687)

<div class="topic-metadata">

**Author:** [@hansthen](https://discuss.python.org/u/hansthen)\
**Replies:** 7\
**Last updated:** [April 22, 2025, 7:29pm UTC](https://discuss.python.org/t/argparse-allow-combining-type-and-choices/88687 "2025-04-22T19:29:32Z")

</div>

Currently, combining type and choices in an argparse Action gives weird usage strings. As a toy example: import argparse parser = argparse.ArgumentParser() names = \["mo", "tu", "we", "th", "fr", "sa", "su"\] days = \[1,…

---

## [An extension for argparse - class based API](https://discuss.python.org/t/an-extension-for-argparse-class-based-api/88319)

<div class="topic-metadata">

**Author:** [@quicknir](https://discuss.python.org/u/quicknir)\
**Replies:** 11\
**Last updated:** [April 19, 2025, 11:05am UTC](https://discuss.python.org/t/an-extension-for-argparse-class-based-api/88319 "2025-04-19T11:05:58Z")

</div>

Many other programming languages have argument parsing libraries that operate by simply writing a struct, with some additional annotations. The parser then just returns an instance of that struct. The python standard lib…

---

## [Complement of choices in argparse](https://discuss.python.org/t/complement-of-choices-in-argparse/60302)

<div class="topic-metadata">

**Author:** [@suhas.com](https://discuss.python.org/u/suhas.com)\
**Replies:** 5\
**Last updated:** [August 11, 2024, 4:06pm UTC](https://discuss.python.org/t/complement-of-choices-in-argparse/60302 "2024-08-11T16:06:24Z")

</div>

Introduce a complement to choices in argument parser’s add\_argument Proposal: The choices kwarg handling in argparse.\_ActionsContainer.add\_argument enables user to restrict the argument’s value to a specified list of ap…

---

## [Named arguments in CLI application](https://discuss.python.org/t/named-arguments-in-cli-application/55352)

<div class="topic-metadata">

**Author:** [@abessman](https://discuss.python.org/u/abessman)\
**Replies:** 5\
**Last updated:** [June 10, 2024, 10:58am UTC](https://discuss.python.org/t/named-arguments-in-cli-application/55352 "2024-06-10T10:58:54Z")

</div>

I’m writing a command line application, and have been reading up on best practices. In particular, I’ve come across these two recommendations, which are giving me some trouble: “If you’ve got two or more arguments for …
