Why does argparse return None instead of [] if an append action isn't used?

Skip Montanaro skip.montanaro at gmail.com
Fri Jan 9 09:57:03 EST 2015


> I noticed in use that if an option with the 'append' action isn't
> used, argparse assigns None to it rather than an empty list, &
> confirmed this interactively:

I don't use argparse (or optparse), being a getopt Luddite myself, but
can you set the default for an action in the add_argument call?

Skip



More information about the Python-list mailing list