On 31Aug2013 14:17, Terry Reedy <tjre...@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 <c...@zip.com.au> You wouldn't... ...but you KNOW you could. - Original V65 Commercial -- http://mail.python.org/mailman/listinfo/python-list