[issue17050] argparse.REMAINDER doesn't work as first argument

2020-05-24 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-05-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 46c1b9c7b595cd9244020ff74ff9cb11bec9870c by Miss Islington (bot) in branch '3.9': bpo-17050: Remove documentation on argparse.REMAINDER (GH-18661) (GH-20363) https://github.com/python/cpython/commit/46c1b9c7b595cd9244020ff74ff9cb11bec9870c

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-05-24 Thread miss-islington
miss-islington added the comment: New changeset 59f5022b5d3e5fcc60ac61cc256b627decf8ee68 by Albert in branch 'master': bpo-17050: Remove documentation on argparse.REMAINDER (GH-18661) https://github.com/python/cpython/commit/59f5022b5d3e5fcc60ac61cc256b627decf8ee68 -- nosy:

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-05-24 Thread miss-islington
Change by miss-islington : -- pull_requests: +19627 pull_request: https://github.com/python/cpython/pull/20363 ___ Python tracker ___

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-02-25 Thread Roundup Robot
Change by Roundup Robot : -- keywords: +patch nosy: +python-dev nosy_count: 4.0 -> 5.0 pull_requests: +18022 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/18661 ___ Python tracker

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-02-18 Thread hai shi
hai shi added the comment: > Okay. Would it be all right if I submit a fix to get it working at least in > the subparser case? Hi, dHannasch. According raymond and paul's opinion, you could try to create a PR to update argparse's doc. -- nosy: +shihai1991

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-02-15 Thread dHannasch
dHannasch added the comment: Okay. Would it be all right if I submit a fix to get it working at least in the subparser case? -- ___ Python tracker ___

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-02-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur with Paul's suggestion. -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python versions: +Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

[issue17050] argparse.REMAINDER doesn't work as first argument

2020-02-13 Thread dHannasch
dHannasch added the comment: I've attached a file that can be run, but it's a simple script that I can include here inline, too: """ Context: I am trying to set up a cookiecutter so that newly-created packages will come with a Jupyter notebook users can play with. That is, python -m

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-04-24 Thread paul j3
paul j3 added the comment: Since this feature is buggy, and there isn't an easy fix, we should probably remove any mention of it from the docs. We can still leave it as an undocumented legacy feature. There is precedent for leaving `nargs` constants undocumented.

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-04-24 Thread Alden
Alden added the comment: Paul. This is a bug, not a feature in argparse. Devin is 100% correct. According to the docs REMAINDER should be greedy and is used for passing arguments to sub commands. In your example the expected behavior is that if you do put "d

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-16 Thread paul j3
paul j3 added the comment: A REMAINDER that would work with a flag-like string would be too powerful, too greedy. In [64]: p = argparse.ArgumentParser(); In [65]: p.add_argument('--foo'); In [66]: p.add_argument('rest', nargs='...'); If the flag is first, its

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer
Change by Devin Bayer : -- nosy: -akvadrako ___ Python tracker ___ ___ Python-bugs-list

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer
Devin Bayer added the comment: This bug is 5 years old and you are arguing what? That it doesn't matter because it's rarely used compared to some undocumented useless alternative? It's mildly interesting to hear about some implementation detail but I really don't care. I

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread paul j3
paul j3 added the comment: REMAINDER is not widely used, and probably was not tested thoroughly during development. It works for the example given in the docs. A variant, argparse.PARSER ('A...') is widely used. This is, effectively, REMAINDER ('...') that requires an

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread paul j3
paul j3 added the comment: Oops, I see I already mentioned 9334. Here the parsing sequence is a bit different, and the fix I suggest there would not apply here. But the underlying issue is still there - the parser has, in its first iteration, determined that the '--def'

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer
Devin Bayer added the comment: I still don't understand how that corresponds to the described behavior of REMAINDER and what it has to do with this bug. How can REMAINDER possibly ever work if optionals take priority? However it does when it's not the first argument.

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread paul j3
paul j3 added the comment: This is another expression of the bigger problem of handling arguments that look like flags. In optparse the 'nargs' (or equivalent, it doesn't handle positionals), control how many arguments an Option takes, regardless of their form. In

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer
Devin Bayer added the comment: I don't understand how this is about positionals vs optionals. REMAINDER is supposed to capture everything from that point forward, not just positionals. -- ___ Python tracker

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer
Devin Bayer added the comment: Can we at least document that argparse.REMAINDER cannot be used as the first argument? -- ___ Python tracker

[issue17050] argparse.REMAINDER doesn't work as first argument

2018-02-14 Thread Devin Bayer
Change by Devin Bayer : -- nosy: +akvadrako ___ Python tracker ___ ___ Python-bugs-list

[issue17050] argparse.REMAINDER doesn't work as first argument

2015-09-29 Thread Daniel Shahaf
Changes by Daniel Shahaf : -- nosy: +danielsh ___ Python tracker ___ ___

[issue17050] argparse.REMAINDER doesn't work as first argument

2013-04-17 Thread paul j3
paul j3 added the comment: The problem isn't with REMAINDER, but with the distinction between optionals and arguments. If you change '--def' to 'def', the parse should work: p = ArgumentParser(prog='test.py') p.add_argument('remainder', nargs=argparse.REMAINDER) p.parse_args(['def'])

[issue17050] argparse.REMAINDER doesn't work as first argument

2013-04-17 Thread paul j3
paul j3 added the comment: Here's a way of passing an optional-like argument to a subparser: parser = argparse.ArgumentParser() subparsers = parser.add_subparsers(dest='cmd') sub1 = subparsers.add_parser('cmd') sub1.add_argument('foo',nargs='*') args = parser.parse_args('cmd

[issue17050] argparse.REMAINDER doesn't work as first argument

2013-01-27 Thread Chris Jerdonek
New submission from Chris Jerdonek: Works: p = ArgumentParser(prog='test.py') p.add_argument('pos') p.add_argument('remainder', nargs=argparse.REMAINDER) p.parse_args(['abc', '--def']) Namespace(pos='abc', remainder=['--def']) Doesn't work: p = ArgumentParser(prog='test.py')