I have a Python program (currently Python 2.7, still undecided about upgrading to Python 3) that receives arguments via argparse, with one positional argument whose length is variable (nargs="+"). I need to add another option which also has a variable length.
I saw that argparse has some kind of support for two variable length arguments but since one of them in my case is positional it means that it creates ambiguity if the end user happens to pass the new variable length option as the last option before the positional argument. Changing the positional argument to be named will break existing APIs so it's not possible unfortunately.
I also thought about the possibility of specifying the same option multiple times (e.g. -c val1, -c val2, -c val3 etc.), which is pretty much the same as this question: Using the same option multiple times in Python's argparse, but that question does not have a direct answer (only workarounds, which assume that there is no more than one variable length argument so not really useful to me).
Any ideas what is the best approach here will be greatly appreciated.