Re: already written optparse callback for range and list arguments?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: already written optparse callback for range and list arguments?

From: Peter Hansen <peter@engcorp.com>
Date: Sun Jul 10 2005 - 04:22:52 CEST

Alex Gittens wrote:
> I would like my program to accept a list of range values on the
> command line, like
> -a 1
> -a 1-10
> -a 4,5,2
>
> In the interest of avoiding reinventing the wheel, is there already
> available code for a callback that would enable optparse to parse
> these as arguments?

Doesn't that depend on what you plan to do with them? Do you want them
as a special Range object, or a series of integers, or a list of tuples,
or what?

-Peter
Received on Thu Sep 29 16:51:35 2005