Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.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.060 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'parser': 0.05; 'useful,': 0.15; '--help': 0.16; 'argparse,': 0.16; 'none"': 0.16; 'subject:values': 0.16; 'wrote:': 0.18; "doesn't": 0.22; 'header :In-Reply-To:1': 0.22; 'received:74.125.82.174': 0.24; 'code': 0.25; 'pass': 0.29; 'pm,': 0.29; "isn't": 0.33; 'message- id:@gmail.com': 0.33; 'header:User-Agent:1': 0.33; 'there': 0.33; 'it?': 0.33; 'to:addr:python-list': 0.34; 'probably': 0.34; 'received:74.125.82': 0.35; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; "there's": 0.37; 'received:10.0.0': 0.38; 'option': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'show': 0.67; 'customized': 0.79; 'andrea': 0.84; 'opinion.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=nDpl9A4/FgPuTDQ9zlLdcnhXnA6j86G+Kxgfh7yF1qg=; b=mwBf0mWjS/6APssCfXhbie/apyfYo1xQO1U/NnmEORwTidJbfRdfquIqI7xPnuJAnR DSAWTrwFClg5CfahG5Kl7TXcKKmsS+TJhcbhMtdboM5RgIagR/ZAwtaXKvIyqTiaUL/f DR3lbRt+qp9EO7+bCcV0HddTk8uotQNLQumqc= Date: Thu, 05 Jan 2012 13:29:34 +0000 From: Andrea Crotti User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111224 Thunderbird/9.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: argparse and default values References: <4F05A489.1010604@gmail.com> In-Reply-To: <4F05A489.1010604@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325770178 news.xs4all.nl 6904 [2001:888:2000:d::a6]:38839 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18549 On 01/05/2012 01:24 PM, Andrea Crotti wrote: > There's one thing I don't understand about argparse, why doesn't > --help show what is the default value?? > I mean if I add an option that can be customized it would be good for > the user > to know what is the current value in my opinion. > > Is there a way to make it show it? Looking at the code I found it already parser = argparse.ArgumentParser(description=description, formatter_class=argparse.ArgumentDefaultsHelpFormatter) the only thing is that it displays also "default: None" which isn't probably very useful, but it would easy to write my own formatter and pass it if I don't like this..