[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2022-02-17 Thread Walter Doekes
Change by Walter Doekes : -- nosy: +wdoekes ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2021-12-11 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11: >>> import argparse >>> parser = argparse.ArgumentParser(prog='PROG') >>> >>> parser.add_argument('--badger', nargs='+') _StoreAction(option_strings=['--badger'], dest='badger', nargs='+', const=None, default=None, type=None, choices=None,

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2020-05-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: Paul, do you have any thoughts on this one. ISTM that this issue isn't well suited for a newcomer because it's somewhat complex and it isn't clear what if anything should be done. -- nosy: +rhettinger priority: high -> normal

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2020-05-28 Thread Dávid Horváth
Change by Dávid Horváth : -- nosy: +Dávid Horváth ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2019-10-31 Thread Jackson Riley
Jackson Riley added the comment: I'm a newcomer and thought about trying to follow up on this and potentially update existing patches, would this be a good idea? -- nosy: +jacksonriley ___ Python tracker

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2018-12-03 Thread kernc
Change by kernc : -- nosy: +kernc ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2018-12-03 Thread Lars Beckers
Change by Lars Beckers : -- nosy: +extmind ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2018-10-16 Thread sebix
Change by sebix : -- nosy: +sebix ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2018-03-21 Thread TD22057
TD22057 added the comment: Is there any chance this will ever get fixed? Patches have been available for 5 years with no progress. -- ___ Python tracker

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2017-01-19 Thread paul j3
paul j3 added the comment: Recent StackOverFlow question related to this issue - where the following positional is a subparsers. http://stackoverflow.com/questions/41742205/how-to-argparse-with-nargs-and-subcommands -- ___ Python tracker

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2017-01-19 Thread paul j3
Changes by paul j3 : -- priority: normal -> high ___ Python tracker ___ ___

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2017-01-07 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +berker.peksag ___ Python tracker ___ ___

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2014-04-23 Thread Jakub Wilk
Changes by Jakub Wilk jw...@jwilk.net: -- nosy: +jwilk ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338 ___ ___ Python-bugs-list mailing list

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2014-04-22 Thread paul j3
paul j3 added the comment: http://bugs.python.org/issue15112 breaks one test that I added to issue +class TestPositionalsAfterOptionalsPlus(ParserTestCase): +Tests specifying a positional that follows an arg with nargs=+ +http://bugs.python.org/issue9338#msg111270 +

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-10-21 Thread Paul Hawkins
Paul Hawkins added the comment: I ran into this bug the first time I needed nargs + in a tool. I found of course that if the option with the nargs is followed by another option before the positional arguments it will work as expected. But then the help would have to point this out, and it

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-10-21 Thread paul j3
paul j3 added the comment: parse_args() would see ['-foo', 'bar1,bar2,bar3', 'pos1', 'pos2']. The splitting on space is done by the shell. So having your own code split 'bar1,bar2,bar3' is simplest. But that would be messed up if the user entered 'bar1, bar2, bar3...'. You could also ask

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-07-17 Thread TD22057
Changes by TD22057 ted.dr...@gmail.com: -- nosy: +TD22057 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338 ___ ___ Python-bugs-list mailing list

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-23 Thread paul j3
paul j3 added the comment: Here's another approach to the problem, using an iterative localized search. For simple cases it produces the same thing, but in complex cases it is more robust. It is based on two ideas: - if the action in consume_optional() is being 'greedy', use slots =

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-23 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: Removed file: http://bugs.python.org/file30349/argparse_7.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338 ___

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-23 Thread paul j3
paul j3 added the comment: Oops, I attached the wrong file. Here's the correct one. -- Added file: http://bugs.python.org/file30350/issue9338_7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-17 Thread paul j3
paul j3 added the comment: This patch implements, I think, the ideas bethard proposed. It is test patch, not intended for production. Most of work is in ArgumentParser._get_alt_length() which - generates a pattern along the lines bethard proposed - generates a string like arg_strings_pattern,

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-17 Thread paul j3
paul j3 added the comment: This is a test file for the patch I just submitted. It is not a formal unitttest, but uses print output as much as assert. Cases include the example bethard used, as well as ones from test_argparse.py that initially caused problems. -- Added file:

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-14 Thread paul j3
paul j3 added the comment: I need to make one correction to my last post: '-x 1 2 -w 3 4 5 6', # w:3, x:[1,2], y:4, z:[5,6] + # w:3, x:[1], y:2, z:[4,5,6] - The second solution is only possible if 'z' is not consumed when 'y' is being processed. In current

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-13 Thread paul j3
paul j3 added the comment: I've played a bit the idea that barthard sketched. I don't have all the details worked out, but I believe this is what will happen: With parser = argparse.ArgumentParser() parser.add_argument('-w') parser.add_argument('-x', nargs='+')

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2013-05-12 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338 ___ ___ Python-bugs-list mailing list

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2012-07-23 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: So Kotan's patch doesn't actually solve the original problem. Instead, it inserts the workaround into the help message of the parser. I think this is probably not the right fix. We should probably do two things: (1) Right now: create

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2012-07-23 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: And I guess Issue 9182 is the right place for (1). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338 ___