unexpected optparse set_default/set_defaults behavior

samwyse dejanews at email.com
Sat Aug 18 07:13:45 EDT 2007


mbeachy at gmail.com wrote:
> Some rather unexpected behavior in the set_default/set_defaults
> methods for OptionParser that I noticed recently:
[...]
> Why does set_default not raise an exception when passed a key that it
> doesn't recognize?
> 
> Bad typysts bewaer.
> 
> The only reason I can think not to raise an exception is so that
> defaults can be defined before the options are added. Is there some
> use case that I'm not thinking of here? I realize that changing this
> could break some existing scripts, but I'm still tempted to file this
> as a bug.

If you file it as a bug then I can assure you that you'll be told of a 
long list of use-cases that depend on that feature.



More information about the Python-list mailing list