Alex Kanitz <alexander.kanitz@sib.swiss> added the comment:

Given that people were asking for real-world use cases, here's one: 
high-throughput sequencing, e.g., in RNA-Seq 
(https://en.wikipedia.org/wiki/RNA-Seq), typically yields either one or two 
output files, depending on the type of the sequencing library. As the 
processing of these library types is very similar, bioinformatics tools dealing 
with these inputs thus typically have APIs that take exactly 1 or 2 files as 
inputs. As there is quite a wide range of tools for dealing with such inputs, 
several of which implemented in Python, I believe there is indeed an interest 
in this functionality. On a more conceptual note: it is also consistent with 
similar and often-used functionality in regexes, from which, I suppose, the '+' 
and '*' notation is borrowed.

Currently implementing such a tool, I ran into the argparse limitation 
described here: either I (a) use a positional param with nargs=1 for the first 
file and define an optional param for the second file (inconsistent, 
non-intuitive and semantically incorrect API, because if there IS a second 
file, it is not really optional), (b) use nargs='+', do the admittedly simple 
post-processing/validation and either ignore keep the auto-generated usage 
string(wrong/misleading), hardcode the correct usage string (maintenance burden 
because of several optional params) or apply this patch (or just the auto-usage 
generation function), which seems rather expensive, or (c) have the user pass 
the second file in one string, separated by a comma or similar (also not very 
intuitive and needs some checks to ensure that the filename/s don't actually 
include commas).

----------
nosy: +uniqueg

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue11354>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to