This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients Laszlo.Attila.Toth, bethard, kalt, paul.j3
Date 2013-04-04.02:12:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365041562.97.0.169630208149.issue13966@psf.upfronthosting.co.za>
In-reply-to
Content
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.)
History
Date User Action Args
2013-04-04 02:12:43paul.j3setrecipients: + paul.j3, bethard, kalt, Laszlo.Attila.Toth
2013-04-04 02:12:42paul.j3setmessageid: <1365041562.97.0.169630208149.issue13966@psf.upfronthosting.co.za>
2013-04-04 02:12:42paul.j3linkissue13966 messages
2013-04-04 02:12:42paul.j3create