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 <rep...@bugs.python.org>
Python-bugs-list mailing list