nodeca/argparse — pull request #42 by hpaulj (2013-01-21 02:04:12+00:00)
Title: Mismatch between py zip() and _.zip()

In `parse_known_args() consume_positionals()`
the` _.zip(positionals, argCounts)`
behaves different from the python version when there aren't as many
`argCounts` as `positionals`. Python zip iterates over the shortest, the
underscore version over the longest, adding undefines as needed.

The `if (argCounts.length>0)` takes care of some cases, but parsing
`'X -f A Y'`, where arguments are -f, x, and y, is another case where
this JS zip is wrong. At the start, there are 2 possible positional
actions `[x, y]`, but only one `[X]` argument string.

Adding an `argCount === undefined` test is the simplest fix.
An alternative is to define a `_zipShortest()` as suggested in
http://stackoverflow.com/questions/4856717/javascript-equivalent-of-pythons-zip-function/13618399#13618399

I added a test case to base.js

I discovered this case when adapting `TestArgumentsFromFile` from `test_argparse.py`