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 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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com