already written optparse callback for range and list arguments?

Discussion in 'Python' started by Alex Gittens, Jul 9, 2005.

  1. Alex Gittens

    Alex Gittens Guest

    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
    --
    ChapterZero: http://tangentspace.net/cz/
    Alex Gittens, Jul 9, 2005
    #1
    1. Advertising

  2. Alex Gittens

    Peter Hansen Guest

    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
    Peter Hansen, Jul 10, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tomi Silander
    Replies:
    3
    Views:
    881
    Grant Edwards
    Apr 6, 2005
  2. sector119
    Replies:
    1
    Views:
    632
  3. Steven W. Orr
    Replies:
    0
    Views:
    428
    Steven W. Orr
    Feb 9, 2007
  4. Steven W. Orr
    Replies:
    3
    Views:
    316
    Steven Bethard
    Feb 11, 2007
  5. Ben Woodcroft
    Replies:
    2
    Views:
    155
    Ben Woodcroft
    May 20, 2009
Loading...

Share This Page