This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients Arfrever, barry, benjamin.peterson, bethard, chris.jerdonek, georg.brandl
Date 2012-09-11.16:15:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347380129.84.0.674520916135.issue15906@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not sure of all the implications of this, but it seems like this is a relevant piece of information from the docs:

"type= can take any callable that takes a single string argument and returns the converted value:"

(from http://docs.python.org/dev/library/argparse.html#type )

In particular, it doesn't seem like it's meant to be supported to be calling "type" on an argument (e.g. a default argument) that's not a string.  That's what's happening in the code snippet in the first comment above, where the default argument is a list.

I haven't thought about this very long, but what would happen if the "type" conversion is only called on arguments and default arguments that are strings, and otherwise left alone?  It seems like that would at least address the use case in the first comment, and maybe the type=open one as well.

Either way, it seems like you still might need to track whether an argument has been converted (e.g. if type converts string to another string type).
History
Date User Action Args
2012-09-11 16:15:30chris.jerdoneksetrecipients: + chris.jerdonek, barry, georg.brandl, bethard, benjamin.peterson, Arfrever
2012-09-11 16:15:29chris.jerdoneksetmessageid: <1347380129.84.0.674520916135.issue15906@psf.upfronthosting.co.za>
2012-09-11 16:15:29chris.jerdoneklinkissue15906 messages
2012-09-11 16:15:28chris.jerdonekcreate