paul j3 added the comment:

One refactoring that I'd like to see is to move all the tests at the end of 
_parse_know_known_args to its caller, parse_known_args.  It would have to 
return more values than the current namespace and extras, in particular the 
see_actions and seen_non_default_actions.

This would have, I think, several benefits:

- it would make easier to customize the testing as proposed by Matthew.  It 
probably would also make it easier to implement the nested-logical-groups that 
I propose in http://bugs.python.org/issue11588.

- It would put the '# Convert action default now instead of doing it before 
parsing arguments' step at the same code level as when the defaults were first 
loaded.

Currently defaults are set at the start of parse_known_args, but evaluated at 
the end of _parse_known_args.  That asymmetry has bugged me for some time.  I'm 
not aware of any bug/issues that have arisen from that, but still it doesn't 
look right.

Last time the 'required' tests were revised, it introduced an error in the 
handling of subparsers.  http://bugs.python.org/issue9253

Subparsers used to be required (default for positionals).  But now they are 
optional unless you add an explicit 'subparsers.required = True' statement.

----------

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

Reply via email to