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

Flavio Percoco flavio at redhat.com
Thu Oct 10 12:40:00 UTC 2013


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.

-- 
@flaper87
Flavio Percoco



More information about the OpenStack-dev mailing list