This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients dbagnall, paul.j3, r.david.murray
Date 2015-08-03.16:40:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Right, the only arguments that a `store_true` Action class accepts are:

     option_strings, dest, default=False,required=False, help=None

parser.add_argument() massages its parameters a bit, and then uses the 'action' parameter to construct an Action subclass object with the other parameters.  Depending on their needs the subclasses may set various defaults or omit certain parameters. And without a catchall '**kwargs', the result of providing an omitted parameter is this error message.

For 'store_true', a 'type' parameter is superfluous.  It doesn't take any arguments (it sets 'nargs=0'), so there aren't any arguments to convert with the 'type' function.  It's the Action's own 'default' and 'const' that provide the required False and True values.

Also 'bool' is not a meaningful 'type' - for any Action class.  There isn't a function in Python converts a string to a boolean.  'bool()' does not do this.  Or rather, `bool(astr)' converts every string to True except the empty one.

I've seen this mistake before, assuming that 'type=bool' means 'I want the result to be a boolean'.  But the docs do say 

    type= can take any callable that takes a single string argument and returns the converted value:

'type=float' means 'use float(astr) to convert astr', not 'the argument should be a float'.

The documentation is not clear about what parameters are valid for each Action type.  It indicates, in bits and pieces, that some parameters are meaningful for certain actions, and not useful for others.  One (version) even takes a parameter that others don't.  But I haven't seen many bugs - here or on StackOverflow - where this is an issue.
Date User Action Args
2015-08-03 16:40:32paul.j3setrecipients: + paul.j3, dbagnall, r.david.murray
2015-08-03 16:40:32paul.j3setmessageid: <>
2015-08-03 16:40:32paul.j3linkissue24754 messages
2015-08-03 16:40:31paul.j3create