getopt with negative numbers?

Steven Bethard steven.bethard at
Fri Sep 28 19:44:07 CEST 2007

Casey wrote:
> Ben Finney wrote:
>> I believe they shouldn't because the established interface is that a
>> hyphen always introduced an option unless (for those programs that
>> support it) a '--' option is used, as discussed.
> Not "THE" established interface; "AN" established interface.  There
> are other established interfaces that have different behaviors. I'm a
> pragmatist; I write software for users, not techies.  I suspect most
> users would expect a command like "abc -a -921 351 175" to treat the
> "-921" as a negative integer and not abort the program with some
> obscure error about option 921 not being known.

Glad I'm not alone in this. ;-) A user shouldn't have to go out of their 
way to specify regular numbers on the command line, regardless of 
whether they're positive or negative.


More information about the Python-list mailing list