[openstack-dev] [Oslo] Change ListOpt and DictOpt default values

Mark McLoughlin markmc at redhat.com
Thu Oct 10 14:29:45 UTC 2013


Hi Flavio,

On Thu, 2013-10-10 at 14:40 +0200, Flavio Percoco wrote:
> Greetings,
> 
> I'd like to propose to change both ListOpt and DictOpt default values
> to [] and {} respectively. These values are, IMHO, saner defaults than
> None for this 2 options and behavior won't be altered - unles `is not
> None` is being used.
> 
> Since I may be missing some history, I'd like to ask if there's a
> reason why None was kept as the default `default` value for this 2 options?
> 
> As mentioned above, this change may be backward incompatible in cases
> like:
> 
>     if conf.my_list_opt is None:
>         ....
> 
> Does anyone if there are cases like this?

I'd need a lot of persuasion that this won't break some use of
oslo.config somewhere. Not "why would anyone do that?" hand-waving.
People do all sorts of weird stuff with APIs.

If people really think this is a big issue, I'd make it opt-in. Another
boolean flag like the recently added validate_default_values.

As regards bumping the major number and making incompatible changes - I
think we should only consider that when there's a tonne of legacy
compatibility stuff that we want to get rid of. For example, if we had a
bunch of opt-in flags like these, then there'd come a point where we'd
say "let's do 2.0 and clean those up". However, doing such a thing is
disruptive and I'd only be in favour of it if the backwards compat
support was really getting in our way.

Thanks,
Mark.




More information about the OpenStack-dev mailing list