Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'anyway.': 0.05; 'say,': 0.05; 'arguments': 0.09; 'default.': 0.09; 'subject:command': 0.09; 'cc:addr:python-list': 0.11; 'boolean': 0.16; 'henry': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'wed,': 0.18; 'trying': 0.19; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'case.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'sort': 0.25; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'could': 0.34; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'charset:us- ascii': 0.36; 'rather': 0.38; 'even': 0.60; 'between': 0.67; 'default': 0.69; 'awesome,': 0.84; 'distinguish': 0.84; '2013,': 0.91 Date: Wed, 15 May 2013 09:16:35 -0500 (CDT) From: Wayne Werner X-X-Sender: wayne@gilgamesh To: Henry Leyh Subject: Re: Determine actually given command line arguments In-Reply-To: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: python-list@python.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368627442 news.xs4all.nl 15982 [2001:888:2000:d::a6]:50110 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45345 On Wed, 15 May 2013, Henry Leyh wrote: > Yes, I was trying that and it sort of works with strings if I use something > sufficiently improbable like "__UNSELECTED__" as default. But it gets > difficult with boolean or even number arguments where you just may not have > valid "improbable" defaults. You could now say, so what, it's the default > anyway. But in my program I would like to distinguish between given and not > given arguments rather than between default and non-default. Have you looked into docopt? It's pretty awesome, and might really help in this case. HTH, -W