[docs] [issue16418] argparse with many choices can generate absurdly long usage message
Terry J. Reedy
report at bugs.python.org
Sun Nov 11 18:53:22 CET 2012
Terry J. Reedy added the comment:
Juraj: Is the example behavior from Py2 or Py3? The meaning of 'range' changed. In Py2, xrange would be the correct choice for 'choice'.
Does argparse actually convert (x)range objects to a list or set (the help indicates the latter) for internal use? That would be foolish as 'n in <range>' is an O(1) operation. (I don't remember is that works for xrange.) For instance, range(0, 1000, 2) is a nice way to say 'even count less than 1000'.
If it is not so converted, converting for display is also foolish.
'range(0, 1000, 2)' is clearer than an explicit sequence.
nosy: +bethard, terry.reedy
Python tracker <report at bugs.python.org>
More information about the docs