comparison example/argparse_undefined.py @ 142:efd2d3330296

wip
author Jeff Hammel <k0scist@gmail.com>
date Mon, 01 Dec 2014 18:08:58 -0800
parents c6aea14a3e2b
children 2825b0fdf80e
comparison
equal deleted inserted replaced
141:c6aea14a3e2b 142:efd2d3330296
12 12
13 Undefined = Undefined() 13 Undefined = Undefined()
14 14
15 class UndefinedArgumentParser(argparse.ArgumentParser): 15 class UndefinedArgumentParser(argparse.ArgumentParser):
16 16
17 def __init__(self, *args, **kwargs):
18
17 def add_argument(self, *args, **kwargs): 19 def add_argument(self, *args, **kwargs):
18 kwargs.setdefault('default', Undefined) 20 kwargs.setdefault('default', Undefined)
19 return argparse.ArgumentParser.add_argument 21 return argparse.ArgumentParser.add_argument
20 22
21 def main(args=sys.argv[1:]): 23 def main(args=sys.argv[1:]):