A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-March/098283.html below:

[Python-Dev] argparse ugliness

[Python-Dev] argparse ugliness [Python-Dev] argparse uglinessMark Russell mark.russell at zen.co.uk
Mon Mar 8 11:25:16 CET 2010
On 7 Mar 2010, at 19:49, Guido van Rossum wrote:
> How would you write the example instead then?

Boolean flags are a common enough case that I'd be inclined to add a wrapper method, so you could just say:

	parser.add_bool_argument('--plot')

As you can always fall back to the more general add_argument() call, the wrapper could just handle the usual case (default false, presence of option sets flag to True).  So the signature would be pretty simple - something like:

	def add_bool_argument(self, help=None, dest=None):

Mark Russell
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4