Steven Bethard <[email protected]> added the comment:

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.

----------

_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9334>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to