Ben Finney writes:
> Miki Tebeka writes:
> > The way I'm doing it currently is:
> > ...
> > no_edit = 'no-edit'
> > parser.add_argument('-e', '--edit', help='open editor on log',
> > nargs='?',
> > default=no_edit)
>
> There is a built-in “no value specified”
> There is a built-in “no value specified” value in Python: the None
> singleton. The ‘argparse’ library uses this for the argument default
> already, so you don't need to fuss with your own special handling
> http://docs.python.org/library/argparse.html#default>.
The problem with this approach is
On Thu, 17 May 2012 14:26:50 -0700 (PDT)
Miki Tebeka 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
Miki Tebeka writes:
> 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.
So, two rather separate tasks: handl
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.
The way I'm doing it currently is:
...
no_ed