argparse - option with optional value

Miki Tebeka miki.tebeka at gmail.com
Fri May 18 09:55:32 EDT 2012


> 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
> <URL:http://docs.python.org/library/argparse.html#default>.
The problem with this approach is that in both cases of not specifying -e and with -e with no argument the value of args.edit is None.



More information about the Python-list mailing list