This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jnespolo
Recipients bethard, jnespolo, ned.deily, paul.j3, r.david.murray
Date 2014-10-25.09:43:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414230219.3.0.603183248856.issue22672@psf.upfronthosting.co.za>
In-reply-to
Content
Ned Deily: I don't quite know how to use unittest, but I'll try to look into it.

paul j3:
> There I proposed leaving '_negative_number_matcher' unchanged, 
> but only use it to set '_has_negative_number_optionals'.

I don't know argparse internals but, if I understand your argument, I think you still need a '_negative_number_matcher' capable of correctly match any negative number in any form, including scientific notation, complex j, etc..
If this is the case, then, the matcher could be simplified to something like

    '^-\d+|^-.\d+'

(notice $ removed from current regex) which would only signal that "something that starts like a negative number" is present.
Then one could use complex() or float() or whatever, to check that that's actually the case.

I would still expect an exception to be raised if, say, I specify type=float and then a complex value is passed as an argument.
History
Date User Action Args
2014-10-25 09:43:39jnespolosetrecipients: + jnespolo, bethard, ned.deily, r.david.murray, paul.j3
2014-10-25 09:43:39jnespolosetmessageid: <1414230219.3.0.603183248856.issue22672@psf.upfronthosting.co.za>
2014-10-25 09:43:39jnespololinkissue22672 messages
2014-10-25 09:43:38jnespolocreate