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 paul.j3
Recipients paul.j3, pgacv2
Date 2017-05-06.16:32:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I didn't mean to question the use of value tests in the 'type' callable.  The ArgumentTypeError example in the documentation does that kind of test.

Argparse is using the term 'type' loosely.  It just means any kind of conversion and/or test that can be applied to a string.

I doubt if _get_value() ever traps a TypeError.  That error complains about the type of the input argument. As in, for example 'int([])'.  But 'int(astring)' only produces a ValueError.  If the callable issues a TypeError when given a string, it shouldn't be used as a 'type' parameter.

If your prewritten test produces a ValueError, and you don't like the standardization, you can just wrap it in simple function reraises the 'custom' message as an ArgumentTypeError.  There's no other way of identifying a 'custom' message.
Date User Action Args
2017-05-06 16:32:33paul.j3setrecipients: + paul.j3, pgacv2
2017-05-06 16:32:33paul.j3setmessageid: <>
2017-05-06 16:32:33paul.j3linkissue30220 messages
2017-05-06 16:32:32paul.j3create