[issue33109] argparse: make new 'required' argument to add_subparsers default to False instead of True

Wolfgang Maier report at bugs.python.org
Wed May 16 10:03:31 EDT 2018


Wolfgang Maier <wolfgang.maier at biologie.uni-freiburg.de> added the comment:

Try to think of it this way:

By choosing a default of True, every new project with subparsers that aims for Python <3.7 compatibility will have to take some measures (either overwrite the default or special-case 3.3-3.6). So no matter whether this is the "least surprising" choice, it is an inconvenient one that makes the default almost useless for years to come. In the long term, when support for Python<=3.6 is finally not important anymore, you would get a slightly more consistent API (though I never thought of a subparser as a regular positional argument before this issue), but the price for it seems too high to me.

Since backwards compatibility is easy to restore by overwriting the default, I can certainly live with the choice of True, but I think it's not the best one could get out of this new and useful keyword.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33109>
_______________________________________


More information about the Python-bugs-list mailing list