Message189200
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 version, if consume_positionals() is called with a 'AOAAAA' pattern, 'y' will match the first 'A', and 'z' will match ''. That means '4 5 6' will be left over.
It's only when I use the patch in http://bugs.python.org/issue14191#msg187051
(argparse doesn't allow optionals within positionals)
that the processing 'z' is delayed, so it can get [4,5,6].
So at least with the 4 arguments in this example, bethard's idea only seems to make a difference in the case of '-w 1 -x 2 3 4 5', where 'y' lays claim to the last string, and '-x' gets the rest. |
|
Date |
User |
Action |
Args |
2013-05-14 07:45:16 | paul.j3 | set | recipients:
+ paul.j3, bethard, wrobell, eric.araujo, catherine, elsdoerfer, Kotan |
2013-05-14 07:45:16 | paul.j3 | set | messageid: <1368517516.6.0.799210315439.issue9338@psf.upfronthosting.co.za> |
2013-05-14 07:45:16 | paul.j3 | link | issue9338 messages |
2013-05-14 07:45:16 | paul.j3 | create | |
|