Message232679
| Author |
remram |
| Recipients |
remram |
| Date |
2014年12月15日.21:02:07 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1418677327.73.0.355612765077.issue23058@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This works correctly on Python 3.4.
On Python 2.7, argparse seems to completely and silently ignore arguments in some conditions, for instance this setup will cause --verbose to be ignored on the main parser:
options = argparse.ArgumentParser(add_help=False)
options.add_argument('-v', '--verbose', action='store_true')
parser = argparse.ArgumentParser(parents=[options])
subparsers = parser.add_subparsers()
parser_cmd = subparsers.add_parser('cmd', parents=[options])
Full runnable example here: http://paste.pound-python.org/show/XfVVhdJHSPISXLP1lASd/
Might or might not be related to #9351, workarounds welcome. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年12月15日 21:02:07 | remram | set | recipients:
+ remram |
| 2014年12月15日 21:02:07 | remram | set | messageid: <1418677327.73.0.355612765077.issue23058@psf.upfronthosting.co.za> |
| 2014年12月15日 21:02:07 | remram | link | issue23058 messages |
| 2014年12月15日 21:02:07 | remram | create |
|