paul j3 <ajipa...@gmail.com> added the comment:
The 'choices' mechanism is quite simple. As noted for testing it simply uses an 'in' test. For help formating it uses choice_strs = [str(choice) for choice in action.choices] result = '{%s}' % ','.join(choice_strs) In other words, it's treated as a iterable. But it is easy to produce unmanageable displays, such as with 'range(100)'. This has been raised in other bug/issues. The best way around that is with the 'metavar', which lets you customize the 'usage' and 'help'. One thing that 'metavar' does not help with is the error display. I'm not privy to the original author's thinking, but I don't think 'choices' was ever meant to be a high power tool. With a custom Action you can do almost anything that you could do after parsing. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34188> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com