Glenn Linderman <v+pyt...@g.nevcal.com> added the comment:

Interesting that the behavior is intentional, yet it accepts positional 
parameters either before, or after, or between optional (flag) parameters.

This seems to me to be a case where proper documentation of the intention would 
have led to the realization that it is easier to fix the code than the 
documentation.

The only definition of positional parameters I could find in the present 
documentation is:

When parse_args() is called, optional arguments will be identified by the - 
prefix, and the remaining arguments will be assumed to be positional:

This is simple and succinct, but leads to my interpretation that they can be 
anywhere, intermixed with optional arguments.

Further, optparse, which argparse attempts to replace, permitted positional 
arguments to be intermixed with optional arguments, see new file t13.py which 
demonstrates that.

To document that positional parameters must be grouped together, yet can appear 
anywhere, the documentation would have to get much more verbose...  something 
like

All positional parameters must be grouped together in a single sequence.  
However, that group of parameters may have optional parameters either before it 
or after it, or there may be optional parameter both before it and after it.

----------
Added file: http://bugs.python.org/file24749/t13.py

_______________________________________
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