Enchancement suggestion for argparse: intuit type from default

rusi rustompmody at gmail.com
Wed Mar 14 11:22:02 CET 2012


On Mar 14, 2:08 am, r... at panix.com (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?

Sounds reasonable to me



More information about the Python-list mailing list