Petri Lehtinen <[email protected]> added the comment:
Yes, but required=True/False makes an *option* required or optional. Setting
required=False is not allowed with *positionals*:
>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('foo', required=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/argparse.py", line 1262, in add_argument
kwargs = self._get_positional_kwargs(*args, **kwargs)
File "/usr/lib/python2.7/argparse.py", line 1367, in _get_positional_kwargs
raise TypeError(msg)
TypeError: 'required' is an invalid argument for positionals
I assume that this is the case that is being documented here, so it should read
"options only" meaning "not allowed for positionals". Am I correct?
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12714>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com