paul j3 added the comment:

The optparse page gives a reason for disable_interspersed_args():

"Use this if you have a command processor which runs another command which has 
options of its own and you want to make sure these options don’t get confused. 
For example, each command might have a different set of options."

In argparse:
"argparse.REMAINDER. All the remaining command-line arguments are gathered into 
a list. This is commonly useful for command line utilities that dispatch to 
other command line utilities:"

If you have only one positional argument, and its nargs is REMAINDER, you have 
effectively disabled interspersed.

Argparse doesn't prohibit all interspersed positionals.  You could, for 
example, have one or more positionals with other nargs that could be 
interspersed.  But the REMAINDER one has to be last.

In the library, profile.py uses 'optparse.disable_interspersed'.  I just 
replaced optparse with argparse using the REMAINDER, and got the same behavior. 
 (Actually I used argparse.PARSER which effectively requires at least one 
argument.)

----------
nosy: +paul.j3

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

Reply via email to