Message229689
| Author |
jnespolo |
| Recipients |
jnespolo |
| Date |
2014年10月19日.18:10:15 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1413742215.74.0.884028294997.issue22672@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Argparse fails to recognise negative numbers in scientific notation as valid numbers.
Example:
Suppose the program test.py has this option.
par.add_argument('-a', type=float)
then './test.py -a -1e5' will fail, as well as -1.0e-4, -.5E+4 and variations thereof.
Furthermore, at the current state, it seems that argparse does not recognize -1. as a valid float either.
I tried to hack argparse.py myself, and I believe the patch attached should fix this issue. The base version of argparse.py is the one from Python 3.4.2 as found in Debian Sid.
The modified regular expression seemed to behave correctly in all test cases I could come up with. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2014年10月19日 18:10:15 | jnespolo | set | recipients:
+ jnespolo |
| 2014年10月19日 18:10:15 | jnespolo | set | messageid: <1413742215.74.0.884028294997.issue22672@psf.upfronthosting.co.za> |
| 2014年10月19日 18:10:15 | jnespolo | link | issue22672 messages |
| 2014年10月19日 18:10:15 | jnespolo | create |
|