paul j3 added the comment:

How about:

    These store the values True and False respectively (and default to False 
and True if absent).

The reference to `store_const` is confusing, since almost no one uses that 
action.

The `store_const` paragraph has:

    (Note that the const keyword argument defaults to the rather unhelpful 
None.) 

But the most common `store` action also defaults to the default default None.  
In fact most action types do that.

With 'store' action, None is a useful default, since its impossible to provide 
in the commandline.  Thus

     if args.foo is None:

is a clear test that 'foo' was not present in the commandline.  I can imagine 
using the same test on a 'store_const' argument (though I've never had the need 
to use it or recommend it).

I'm almost of the opinion that we should remove that parenthetical remark.

The 'const' parameter is used most often with 'store' and "nargs='?'", as 
illustrated in that 'nargs' subsection.

To complicate things, if I provide a "argument_default='boo'" parameter in the 
parser definition, it overrides all of these default defaults, including for 
'store_true'.  In that case an explicit 'default=False' is *required*, not 
superfluous.

To further complicate things, 'parser.set_defaults' can override all of these.

We've almost given users too many ways of setting 'default'. :)  Fortunately in 
practice they don't use most of them.

----------

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

Reply via email to