[issue16977] argparse: mismatch between choices parsing and usage/error message

Jeff Knupp report at bugs.python.org
Fri Jan 18 20:38:31 CET 2013


Jeff Knupp added the comment:

The only time this would be an issue is for infinite sequences via range or a generator, which doesn't work anyway.

>>> p = argparse.ArgumentParser()
>>> a = p.add_argument('a', choices=itertools.count(0), type=int)
>>> p.parse_args(['10000'])
... hangs

Are there any other cases where coercing to a list wouldn't work?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16977>
_______________________________________


More information about the Python-bugs-list mailing list