[issue1243] option.dest not set when callback called with optparse
Raghuram Devarakonda
report at bugs.python.org
Mon Oct 8 16:47:56 CEST 2007
Raghuram Devarakonda added the comment:
>
> But what type should I specify?
>
> I was using a callback to get a datetime object as an option...
>
If you are looking for a new type of option than what are already
supported (string, int, long, choice, float and complex), you need to
extend optparse (there is a section for that). I personally prefer a
simple approach where the option value is taken as a string and any
processing is done on the value to convert to what ever type of object
one wants. For example, in this case, you can convert a string, say,
2007-10-8, internally to a datetime object.
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1243>
__________________________________
More information about the Python-bugs-list
mailing list