paul j3 <ajipa...@gmail.com> added the comment: I attached a script that implements Evan's _match_argument idea, using a ArgumentParser subclass. I think this is the safest way to add different functionality to the parser. It (subclassing) is used, for example in pypi extensions like plac.
My version places the special nargs case after the default match test. So it acts only if the regular action fails. But I don't know of a test case where that difference matters. I've tested it with all the examples posted in this issue, but have not tested it against test_argparse.py. I'd also like to know if it goes far enough in adapting to optparse/POSIX usage. It probably doesn't. ---------- Added file: https://bugs.python.org/file47404/argparse_opt.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue9334> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com