Re: optparser question

2006-12-22 Thread Steven Bethard
Michele Petrazzo wrote: > Ok, I have not understand the "trickle" for transform the > action="callback" and provide a callback to a new action. Yeah, you're not the only one. ;-) > I believe, however, that the doc has to be more explicit about this > strange behavior, because a not so expert dev

Re: optparser question

2006-12-22 Thread Michele Petrazzo
Steven Bethard wrote: > You can try using argparse_, which doesn't make these weird > inferences, and generally assumes that your action will take a single > argument unless you specify otherwise:: > <-cut-> > Not sure exactly what your callback was trying to do though -- it > seems like you'

Re: optparser question

2006-12-22 Thread Steven Bethard
Michele Petrazzo wrote: > I'm trying optparse and I see a strange (for me) behavior: > > def store_value(option, opt_str, value, parser): > setattr(parser.values, option.dest, value) > > parser = optparse.OptionParser() > parser.add_option("-f", "--foo", > action="callback",

optparser question

2006-12-22 Thread Michele Petrazzo
I'm trying optparse and I see a strange (for me) behavior: def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) parser = optparse.OptionParser() parser.add_option("-f", "--foo", action="callback", callback=store_value,