New submission from Tristan Fisher:

It's my understanding that giving the action="store_true" to an argument in 
argparse defaults to False.  When using non-double-dashed/positional arguments, 
the argument resorts to True (even if explicitly marked default=False).

I've attached a minimal example, but, for clarity, the relevant line is as such:

    parser.add_argument("meow", action="store_true", default=False)


I realize that this might strike some as an odd usage, and I always have the 
option of using "--meow," but I found it odd that a positional argument is 
always True, even if not specified in sys.argv.

----------
components: Library (Lib)
files: argparse_always_true.py
messages: 227584
nosy: Tristan.Fisher
priority: normal
severity: normal
status: open
title: Argparse always stores True for positional arguments
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file36727/argparse_always_true.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22500>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to