Message141816
| Author |
petri.lehtinen |
| Recipients |
docs@python, petri.lehtinen, r.david.murray |
| Date |
2011年08月09日.12:35:08 |
| SpamBayes Score |
1.4141466e-11 |
| Marked as misclassified |
No |
| Message-id |
<1312893309.14.0.812915781754.issue12714@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2011年08月09日 12:35:09 | petri.lehtinen | set | recipients:
+ petri.lehtinen, r.david.murray, docs@python |
| 2011年08月09日 12:35:09 | petri.lehtinen | set | messageid: <1312893309.14.0.812915781754.issue12714@psf.upfronthosting.co.za> |
| 2011年08月09日 12:35:08 | petri.lehtinen | link | issue12714 messages |
| 2011年08月09日 12:35:08 | petri.lehtinen | create |
|