Enchancement suggestion for argparse: intuit type from default

Roy Smith roy at panix.com
Thu Mar 15 09:28:02 EDT 2012


In article <mailman.665.1331806024.3037.python-list at python.org>,
 Robert Kern <robert.kern at gmail.com> wrote:

> Yes. Not all type(default) types can be called with a string to produce a 
> valid 
> value. Note that "type=" is really a misnomer. argparse doesn't really want a 
> type object there; it wants a converter function that takes a string to an 
> object.

Orthogonal to my original suggestion, I agree that this is misnamed.  
I'm +1 on the idea of renaming it to conversion= or something like that 
(we'd need to keep type= around as a deprecated synonym for backwards 
compatability).  It's really hard to get your head around "type=open".



More information about the Python-list mailing list