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

David Ripton dripton at redhat.com
Thu Oct 10 14:03:55 UTC 2013


On 10/10/2013 09:45 AM, Ben Nemec wrote:
> 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.

+1.  boto just broke our builds by making an incompatible API change in 
version 2.14.  We can't make every project in the world not do that, but 
we sure should avoid doing it ourselves.

-- 
David Ripton   Red Hat   dripton at redhat.com



More information about the OpenStack-dev mailing list