Re: Numeric command-line options vs. negative-number arguments

2007-09-28 Thread Steven Bethard
Carl Banks wrote: > On Sep 28, 9:51 am, Steven Bethard <[EMAIL PROTECTED]> wrote: >> It was decided that practicality beats purity here. Arguments with >> leading hyphens which look numeric but aren't in the parser are >> interpreted as negative numbers. Arguments with leading hyphens which >> don'

Re: Numeric command-line options vs. negative-number arguments

2007-09-28 Thread Carl Banks
On Sep 28, 9:51 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > Steven Bethard <[EMAIL PROTECTED]> writes: > >> Argparse knows what your option flags look like, so if you specify > >> one, it knows it's an option. Argparse will only interpret it as a > >> negative number if y

Re: Numeric command-line options vs. negative-number arguments

2007-09-28 Thread Steven Bethard
Ben Finney wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: >> Argparse knows what your option flags look like, so if you specify >> one, it knows it's an option. Argparse will only interpret it as a >> negative number if you specify a negative number that doesn't match >> a known option. > >

Re: Numeric command-line options vs. negative-number arguments

2007-09-28 Thread Ben Finney
Steven Bethard <[EMAIL PROTECTED]> writes: > Did you try it and find it didn't work as you expected? No, I was commenting on the behaviour you described (hence why I said "That would be irritating"). > Argparse knows what your option flags look like, so if you specify > one, it knows it's an opt

Re: Numeric command-line options vs. negative-number arguments

2007-09-27 Thread Steven Bethard
Ben Finney wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > >> In most cases, argparse (http://argparse.python-hosting.com/) >> supports negative numbers right out of the box, with no need to use >> '--': >> >> >>> import argparse >> >>> parser = argparse.ArgumentParser() >> >>> p

Numeric command-line options vs. negative-number arguments (was: getopt with negative numbers?)

2007-09-27 Thread Ben Finney
Steven Bethard <[EMAIL PROTECTED]> writes: > In most cases, argparse (http://argparse.python-hosting.com/) > supports negative numbers right out of the box, with no need to use > '--': > > >>> import argparse > >>> parser = argparse.ArgumentParser() > >>> parser.add_argument('-a', typ