You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add nargs='...' to the reference of add_argument in argparse #101472
The reference for the nargs parameter of add_argument does not include the case when nargs is '...'. A pull request is provided that adds this case to the documentation, including an example of the use.
This was explicitly made undocumented in #61252 / #18661
I would not have made that decision, since argparse.REMAINDER is both useful and very widely used: tens of thousands of hits on https://github.com/search?q=argparse.REMAINDER&type=code. But given that a decision was made by a core dev, I'd feel uncomfortable simply reverting #18661 without more consensus from some other core developers.
Absent that, if someone is interested in picking this up, I think a viable path forward could be to go through these issues https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+argparse.REMAINDER , figure out which ones are definitely bugs and which ones are subideal behaviour that we're stuck with. If we can show we're comfortable with how argparse.REMAINDER works and we expand test coverage, I think that would be a strong reason for redocumenting.
Reacted by Daniel Colascione, Serhiy Storchaka and Brett Cannon
I've opened #160119 to redocument REMAINDER. I think users are better served with this being documented rather than hidden, especially since it's not deprecated and widely used.
Activity
hauntsaninja commentedon Apr 19, 2023
This was explicitly made undocumented in #61252 / #18661
I would not have made that decision, since argparse.REMAINDER is both useful and very widely used: tens of thousands of hits on https://github.com/search?q=argparse.REMAINDER&type=code. But given that a decision was made by a core dev, I'd feel uncomfortable simply reverting #18661 without more consensus from some other core developers.
Absent that, if someone is interested in picking this up, I think a viable path forward could be to go through these issues https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+argparse.REMAINDER , figure out which ones are definitely bugs and which ones are subideal behaviour that we're stuck with. If we can show we're comfortable with how
argparse.REMAINDERworks and we expand test coverage, I think that would be a strong reason for redocumenting.pythongh-101472: Redocument argparse.REMAINDER and its limitations
savannahostrowski commentedon Oct 21, 2026
I've opened #160119 to redocument REMAINDER. I think users are better served with this being documented rather than hidden, especially since it's not deprecated and widely used.
Merge branch 'main' into pythongh-101472-redocument-remainder
Merge branch 'main' into pythongh-101472-redocument-remainder