On Thu, 17 May 2012 14:26:50 -0700 (PDT) Miki Tebeka <miki.teb...@gmail.com> wrote:
> Greetings, > > I'd like to have an --edit option in my program. That if not specified will > not open editor. If specified without value will open default editor > ($EDITOR) and if specified with value, assume this value is the editor > program to run. This looks like a job for 'const': parser.add_argument('-e', '--edit', help='open editor on log', nargs='?', const="$EDITOR") I think that does what you want. HTH, John -- http://mail.python.org/mailman/listinfo/python-list