Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #53375

Re: argparse - specify order of argument parsing?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'arguments': 0.09; 'iterate': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'solution,': 0.09; 'subject:parsing': 0.09; 'jan': 0.12; '*before*': 0.16; 'alvarez': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:argparse': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'header:User-Agent:1': 0.23; 'specify': 0.24; 'environment': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; "skip:' 10": 0.31; 'invoke': 0.31; 'could': 0.34; 'there': 0.35; 'sequence': 0.36; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'expect': 0.39; 'aside': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'remove': 0.60; 'received:173': 0.61; 'forward': 0.65; 'eduardo': 0.84; 'received:fios.verizon.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: argparse - specify order of argument parsing?
Date Sat, 31 Aug 2013 14:17:33 -0400
References <slrnl248ua.4b8.!nospam!astrochelonian@hypnotoad.vtr.net> <kvtbnr$ucq$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
In-Reply-To <kvtbnr$ucq$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.421.1377973205.19984.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377973205 news.xs4all.nl 15993 [2001:888:2000:d::a6]:33862
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53375

Show key headers only | View raw


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.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

argparse - specify order of argument parsing? Eduardo Alvarez <!nospam!astrochelonian@gmail.com> - 2013-08-31 13:11 -0400
  Re: argparse - specify order of argument parsing? Tim Chase <python.list@tim.thechases.com> - 2013-08-31 12:50 -0500
  Re: argparse - specify order of argument parsing? Terry Reedy <tjreedy@udel.edu> - 2013-08-31 14:13 -0400
  Re: argparse - specify order of argument parsing? Terry Reedy <tjreedy@udel.edu> - 2013-08-31 14:17 -0400
  Re: argparse - specify order of argument parsing? Peter Otten <__peter__@web.de> - 2013-09-01 08:53 +0200

csiph-web