zenlotus / argparse

Automatically exported from code.google.com/p/argparse
Other
0 stars 0 forks source link

inconsistent --option=xxx vs --option xxx #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have an option '--si' and and option '--size'  (unintentional)
when used with '=', ambiguous, but when used with ' ', not.

python test_front_end_spec.py --order=3  -e 13.1 --sps='u(2,4)' --alpha
.35 --si 64 --no-notch --size 1000000 

python test_front_end_spec.py --order=3  -e 13.1 --sps='u(2,4)' --alpha
.35 --si=64 --no-notch --size=1000000 
usage: test_front_end_spec.py [-h] [-e ESNODB] [--alpha ALPHA] [--trials
TRIALS] [--order ORDER] [-s SPS] [--size SIZE] [--si SI]
                              [--filter [FILTER]] [--notch [NOTCH]] [--
test_front_end_spec.py: error: ambiguous option: --si=64 could match --si,
--size

Original issue reported on code.google.com by ndbeck...@gmail.com on 4 Dec 2009 at 1:19

GoogleCodeExporter commented 9 years ago
Thanks for the bug report. Fixed in r79.

>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--si')
>>> parser.add_argument('--size')
>>> parser.parse_args(['--si=64'])
Namespace(si='64', size=None)
>>> parser.parse_args(['--si', '64'])
Namespace(si='64', size=None)

Original comment by steven.b...@gmail.com on 7 Dec 2009 at 12:58