Message155185
| Author |
bethard |
| Recipients |
bethard, guilherme-pg, v+python |
| Date |
2012年03月08日.23:29:11 |
| SpamBayes Score |
0.00028991298 |
| Marked as misclassified |
No |
| Message-id |
<1331249352.39.0.482048132089.issue14191@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Thinking about it a bit more, it strikes me that maybe you could get the behavior you want by declaring two parsers, one with just optionals, and one with just positionals. Then:
optional_args, remaining_args = optionals.parse_known_args()
args = positionals.parse_args(remaining_args)
vars(args).update(vars(optional_args))
Basically, you first parse out all the optional arguments, then you parse out the positional arguments from what's left after the optional arguments are stripped out. This approach seems to work for your t14.py. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年03月08日 23:29:12 | bethard | set | recipients:
+ bethard, v+python, guilherme-pg |
| 2012年03月08日 23:29:12 | bethard | set | messageid: <1331249352.39.0.482048132089.issue14191@psf.upfronthosting.co.za> |
| 2012年03月08日 23:29:11 | bethard | link | issue14191 messages |
| 2012年03月08日 23:29:11 | bethard | create |
|