Steven Bethard <steven.beth...@gmail.com> added the comment:

> optparse, which argparse attempts to replace, permitted positional 
> arguments to be intermixed with optional arguments

Sure, but optparse didn't actually parse positional arguments - it just threw 
them into a bag, and then you had to group them and convert them however you 
wanted afterwards. Argparse, instead, was designed to let you specify the 
groups of positional arguments. Your situation is a little different because 
you just want to throw all the positional arguments into a bag again. Not that 
there's anything wrong with that - it's just not the primary use case argparse 
had in mind.

> The only definition of positional parameters I could find...

Yeah, it looks like there's no good documentation on positional vs. optional 
parameters. Somewhere obvious, perhaps right at the beginning of the 
add_argument() documentation, there should probably be something like:

Argparse groups the command line argument strings into two types of groups: 
optional arguments, which are a sequence of command line strings that begin 
with a flag like "-v" or "--verbose", and positional arguments, which are a 
sequence of command line strings that do not begin with a flag. The 
add_argument() method allows you to specify how many command line strings each 
of your optional or positional arguments should consume, how those strings 
should be converted into Python objects, etc.

----------

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

Reply via email to