bug when setting a float value to -10. and not -10.0
londumas opened this issue · comments
Hélion du Mas des Bourboux commented
The bugs is due to self._negative_number_matcher
change:
self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$')
by
self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$|^-\d*\.')
test with:
import argparse as ap
p = ap.ArgumentParser()
p.add_argument("-x", type=float, required=True)
options = p.parse_args()
print(options)