Avoid use xx=[] for parameter to initialize it's value

This patch is deprecated use xx = [] for the parameter initial value,
this parameter will only be initialized at the first call,this is not
what we expected.
Better choice is to set the initial value to None,
then initialize xx with xx= xx or [] in method body.

More details:http://effbot.org/zone/default-values.htm

Change-Id: Ie538081bb8905ed9b6d5ec5fa75c344a8074fb0e
This commit is contained in:
xianming mao 2016-09-25 12:01:05 +08:00
parent 5438b20c46
commit 11de0f3873

View File

@ -33,7 +33,9 @@ from six.moves.urllib import parse
from mistralclient.openstack.common.apiclient import client
def assert_has_keys(dct, required=[], optional=[]):
def assert_has_keys(dct, required=None, optional=None):
required = required or []
optional = optional or []
for k in required:
try:
assert k in dct