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 bethard
Recipients andersk, bethard, eric.smith, gdb, nelhage, r.david.murray
Date 2010-07-23.11:21:11
SpamBayes Score 0.0005364207
Marked as misclassified No
Message-id <1279884074.33.0.439403235075.issue9334@psf.upfronthosting.co.za>
In-reply-to
Content
Note that the negative number heuristic you're complaining about doesn't actually affect your code below. The negative number heuristic is only used when you have some options that look like negative numbers. See the docs for more information:

http://docs.python.org/library/argparse.html#arguments-containing

Your problem is that you want "--safe" to be treated as a positional argument even though you've declared it as an option. Basically there are two reasonable interpretations of this situation. Consider something like "--conf-file --safe". Either the user wants a conf file named "--safe", or the user accidentally forgot to type the name of the conf file. Argparse assumes the latter, though either one is conceivable. Argparse assumes the latter because, while it occasionally throws an unnecessary exception, the other behavior would allow an error to pass silently.

I'm definitely opposed to changing the default behavior to swallow some errors silently. If you'd like to propose an API for enabling such behavior explicitly and supply a patch and tests implementing it, I'll be happy to review it though.
History
Date User Action Args
2010-07-23 11:21:14bethardsetrecipients: + bethard, eric.smith, r.david.murray, andersk, gdb, nelhage
2010-07-23 11:21:14bethardsetmessageid: <1279884074.33.0.439403235075.issue9334@psf.upfronthosting.co.za>
2010-07-23 11:21:12bethardlinkissue9334 messages
2010-07-23 11:21:12bethardcreate