Mailing List Archive

[issue15336] Argparse required arguments incorrectly displayed as optional arguments
New submission from Raymond Hettinger <raymond.hettinger@gmail.com>:

In this script, '-x' is required argument:
------------------------------------------
import argparse
p = argparse.ArgumentParser()
p.add_argument('-x', required=True)
p.print_help()

However, the automatically generated help shows it as optional:
---------------------------------------------------------------
usage: ap_demo.py [-h] -x X

optional arguments:
-h, --help show this help message and exit
-x X

----------
components: Library (Lib)
messages: 165331
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Argparse required arguments incorrectly displayed as optional arguments
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue15336>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue15336] Argparse required arguments incorrectly displayed as optional arguments [ In reply to ]
Changes by Ezio Melotti <ezio.melotti@gmail.com>:


----------
nosy: +bethard, ezio.melotti
stage: -> needs patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue15336>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue15336] Argparse required arguments incorrectly displayed as optional arguments [ In reply to ]
Changes by Éric Araujo <merwok@netwok.org>:


----------
nosy: +eric.araujo

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue15336>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue15336] Argparse required arguments incorrectly displayed as optional arguments [ In reply to ]
Changes by Steven Bethard <steven.bethard@gmail.com>:


----------
resolution: -> duplicate
status: open -> closed
superseder: -> argparse: Default Help Message Lists Required Args As Optional

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue15336>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com