already written optparse callback for range and list arguments?

A

Alex Gittens

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?

Thanks,
Alex
 
P

Peter Hansen

Alex said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top