paul j3 added the comment: 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30220> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com