Author wolma
Recipients Anthony Sottile, bethard, eric.araujo, memeplex, paul.j3, wolma
Date 2018-03-20.13:41:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1521553319.23.0.467229070634.issue33109@psf.upfronthosting.co.za>
In-reply-to
Content
I find the True default for 'required' quite cumbersome introduced as a result of issue 26510.

With existing parsers it can unnecessarily break compatibility between Python3.x versions only to make porting a bit easier for Python2 users.
I think, this late in the life cycle of Python2, within Python3 compatibility should be ranked higher than py2to3 portability.

Command line parsing of a package of mine has long used optional subparsers (without me even thinking much about the fact). Now in 3.7, running

python3.7 -m MyPackage

without arguments (the parser is in __main__.py) I get the ill-formatted error message:

__main__.py: error: the following arguments are required: 

while my code in 3.3 - 3.6 was catching the empty Namespace returned and printed a help message.

Because the 'required' keyword argument did not exist in < 3.7 there was no simple way for me to write code that is compatible between all 3.x versions. What I ended up doing now is to check sys.argv before trying to parse things, then print the help message, when that only has a single item, just to keep my existing code working.

OTOH, everything would be just fine with a default value of False.
Also that truncated error message should be fixed before 3.7 gets released.
History
Date User Action Args
2018-03-20 13:41:59wolmasetrecipients: + wolma, bethard, eric.araujo, memeplex, paul.j3, Anthony Sottile
2018-03-20 13:41:59wolmasetmessageid: <1521553319.23.0.467229070634.issue33109@psf.upfronthosting.co.za>
2018-03-20 13:41:59wolmalinkissue33109 messages
2018-03-20 13:41:58wolmacreate