[openstack-dev] [Oslo] Change ListOpt and DictOpt default values
Ben Nemec
openstack at nemebean.com
Thu Oct 10 13:45:49 UTC 2013
On 2013-10-10 07:40, 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?
>
> Also, I know it is possible to do:
>
> cfg.ListOpt('option', default=[])
>
> This is not terrible, TBH, but it doesn't feel right. I've made the
> mistake to ignore the `default` keyword myself, although I know `[]`
> is not the default option for `ListOpt`. As already said, I'd expect
> `[]` to be the default, non-set value for `ListOpt`.
>
> Thoughts?
>
> Cheers,
> FF
>
> P.S: I'm not sure I'll make it to tomorrows meeting so, I starting the
> discussion here made more sense.
Since this is technically an incompatible API change, would a major
version bump be needed for oslo.config if we did this? Maybe nobody's
relying on the existing behavior, but since oslo.config is a released
library its API is supposed to be stable.
-Ben
More information about the OpenStack-dev
mailing list