This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients Christophe.Guillon, Clint Olsen, abacabadabacaba, amcnabb, andersk, bethard, cben, danielsh, davidben, drm, eric.araujo, eric.smith, evaned, gdb, gfxmonk, karzes, martin.panter, memeplex, nelhage, paul.j3, r.david.murray, rhettinger, skilletaudio, spaceone
Date 2018-01-24.00:35:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516754135.16.0.467229070634.issue9334@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-01-24 00:35:35paul.j3setrecipients: + paul.j3, rhettinger, cben, amcnabb, bethard, eric.smith, eric.araujo, r.david.murray, memeplex, gfxmonk, evaned, andersk, abacabadabacaba, gdb, nelhage, drm, davidben, martin.panter, skilletaudio, Christophe.Guillon, danielsh, spaceone, Clint Olsen, karzes
2018-01-24 00:35:35paul.j3setmessageid: <1516754135.16.0.467229070634.issue9334@psf.upfronthosting.co.za>
2018-01-24 00:35:35paul.j3linkissue9334 messages
2018-01-24 00:35:35paul.j3create