Re: using optparser

2010-10-16 Thread Michele Simionato
Accepting both options and positional arguments for the same purpose does not look like a good idea to me. Anyway, here is a solution using plac (http://pypi.python.org/pypi/ plac) assuming you can afford an external dependency: import plac @plac.annotations( personname=("person to be matched

Re: using optparser

2010-10-16 Thread Jonathan Gardner
g positional arguments in a predefined order > ie, > findmatch  -f schoolmates -i jon -t 3.5 -n 115 > or > findmatch jon schoolmates 115 3.5 > > I tried to code this using optparser.. > > def parse_arguments(): >     usage = """usage: %prog [opt

Re: using optparser

2010-10-16 Thread Chris Hulan
g positional arguments in a predefined order > ie, > findmatch  -f schoolmates -i jon -t 3.5 -n 115 > or > findmatch jon schoolmates 115 3.5 > > I tried to code this using optparser.. > > def parse_arguments(): >     usage = """usage: %prog [opt

using optparser

2010-10-16 Thread jimgardener
3.5 -n 115 or findmatch jon schoolmates 115 3.5 I tried to code this using optparser.. def parse_arguments(): usage = """usage: %prog [options] eg: findmatch -i jon -f schoolmates -n 115 -t 3.5 """ parser = OptionParser(usage) parser.a