New submission from Juraj Variny: Example:
parser.add_argument("-p","--port", help="Listening port", type=int, choices=range(1, 65535),default=8007,required = False) generates this usage text: usage: agent.py [-h] [-p {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, <...snip...> ,65522,65523,65524,65525,65526,65527,65528,65529,65530,65531,65532,65533,65534}] optional arguments: -h, --help show this help message and exit -p {1,2,3,4,5,6,7,8,9,10,11,12,13,14, <...snip...> ,65525,65526,65527,65528,65529,65530,65531,65532,65533,65534} Listening port ---------- components: Library (Lib) messages: 174947 nosy: Juraj.Variny priority: normal severity: normal status: open title: argparse with many choices can generate absurdly long usage message type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16418> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com