[Python-Dev] argparse ugliness

Mark 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:


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