Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #53385
| Date | 2013-09-01 09:44 +1000 |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Subject | Re: argparse - specify order of argument parsing? |
| References | <kvtbvr$ucq$2@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.430.1377994347.19984.python-list@python.org> (permalink) |
On 31Aug2013 14:17, Terry Reedy <tjreedy@udel.edu> wrote: | On 8/31/2013 2:13 PM, Terry Reedy wrote: | >On 8/31/2013 1:11 PM, Eduardo Alvarez wrote: | >>When using argparse, is there a way to specify in what order arguments | >>get parsed? | > | >I expect argparse to forward iterate the sequence of arguments that it | >receives. | | Aside from the environment variable solution, you could search | sys.argv for 'config=filename' and remove it and process it *before* | you invoke argparse. Although, speaking for myself, I like options to have effect as encountered: some-cmd -a --no-foo Would turn on "all" options then turn off "foo". Hard to do if you look for "more important" options and then less important options. I'm personally against out-of-order option handling; it confuses things for the user. If you (as the user) need the config file to be known first, put it first. Cheers, -- Cameron Simpson <cs@zip.com.au> You wouldn't... ...but you KNOW you could. - Original V65 Commercial
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: argparse - specify order of argument parsing? Cameron Simpson <cs@zip.com.au> - 2013-09-01 09:44 +1000
csiph-web