paul j3 added the comment:

Neither 'parents' or 'resolve' are documented in any detail.  Most of what I 
know comes from reading the code.

'parents' are, I think, most useful when importing a parser from some other 
module.  It lets you add arguments to your own parser without digging into the 
other module's code.  And 'resolve' lets you overwrite arguments.  

Copying arguments by reference is the easiest thing to do in Python, and 
apparently no one asked, 'what if the user wants to use the parent 
independently?'

Note I had to add a 'copy' method, because nothing else in 'argparse' needs it. 
 And no one has written code to check whether two Actions are the same (other 
than the obvious one of checking object ids).  Again, no need.

Copy and paste and utility functions are great ways of defining multiple 
arguments when mechanisms like 'parents' prove to be too clumsy.  Look at 
`test_argparse.py` for examples of utility code that streamlines parser 
definition.  Each test case requires a new parser (or more).

----------

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

Reply via email to