The __init__
for the store_true
subclass is:
class _StoreTrueAction(_StoreConstAction):
def __init__(self,
option_strings,
dest,
default=False,
required=False,
help=None):
super(_StoreTrueAction, self).__init__(
option_strings=option_strings,
dest=dest,
const=True,
default=default,
required=required,
help=help)
Notice that it sets default=False
. The user code can override that, but what's the point? This subclass is just a store_const
where the default
is False
and the const
is True
.
add_argument
takes a number of keyword parameters and creates an Action
subclass object. Different actions
make use of different combinations of parameters. add_argument
takes a casual approach to required or superfluous parameters. That is, there isn't a lot of code that checks that just the right parameters have been defined.
I'd leave it off since the default is the correct one.
argparse
, and don't see anything wrong with this question.