paul j3 added the comment:
I've experimented with an argparse adaptation of profile.py:
parser = argparse.ArgumentParser(usage=usage)
parser.add_argument('-o', '--outfile', dest="outfile",
help="Save stats to <outfile>", metavar="path")
parser.add_argument('-s', '--sort', dest="sort",
help="Sort order when printing to stdout ...",
default=-1)
parser.add_argument('args', nargs=argparse.PARSER,
metavar="scriptfile [arg] ...")
# expect at least one positional, a py module
It is somewhat like subparsers, but without defined subparser choices. Or you
could say that PARSER (A...) is to REMAINDER (...) as '+' is to '*'. It
requires at least one argument. I could, just as well, have created two
arguments, 'scriptfile' and 'args' (with '...').
I don't know if that is an argument for documenting it or not.
----------
nosy: +paul.j3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue16988>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com