paul j3 <ajipa...@gmail.com> added the comment:
In the Help formatting, choice_strs = [str(choice) for choice in action.choices] The use of `repr` in this check_value() error message was, I think, deliberate. For simple choices like strings and numbers it doesn't matter. But for other cases, it may help to know more about the identify of the choice objects, such as their class. The actual parsing test is just a 'in' test. value not in action.choices There is the added complication that the _get_value() function has already applied the type function the argument string, converting it to a compatible object (for testing). Should argparse be changed, or should it be up to the developer to use a type/choices pairing that gives the desired help and error messages? To improve the discussion, I think your 'self.admin' example should be replaced by a self contained type and class. In the spirit of a StackOverFlow question I'd like concrete minimal example that I can test and play with. I don't want to write a pseudo-account class. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42191> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com