Enchancement suggestion for argparse: intuit type from default

John Nagle nagle at animats.com
Wed Mar 14 19:32:41 EDT 2012


On 3/13/2012 2:08 PM, Roy Smith wrote:
> Using argparse, if I write:
>
>      parser.add_argument('--foo', default=100)
>
> it seems like it should be able to intuit that the type of foo should
> be int (i.e. type(default)) without my having to write:
>
>      parser.add_argument('--foo', type=int, default=100)
>
> Does this seem like a reasonable enhancement to argparse?

    default=None

presents some problems.

				John Nagle



More information about the Python-list mailing list