From f6e549f9bead72dfd522a7a2ae68a3331fb77321 Mon Sep 17 00:00:00 2001 From: lilintan Date: Sun, 25 Sep 2016 10:48:24 +0800 Subject: [PATCH] Set the initial value to None Use xx = [] for the parameter initial value, this parameter will only be initialized at the first call, this is should be avoided. Better choice is to set the initial value to None, then the initialization time use xx= xx or None more information:http://effbot.org/zone/default-values.htm Change-Id: I9f61be1ba38901959d5c9201d41e2ce5911505e5 --- kingbirdclient/openstack/common/apiclient/fake_client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kingbirdclient/openstack/common/apiclient/fake_client.py b/kingbirdclient/openstack/common/apiclient/fake_client.py index 93593d2..a98cd75 100644 --- a/kingbirdclient/openstack/common/apiclient/fake_client.py +++ b/kingbirdclient/openstack/common/apiclient/fake_client.py @@ -33,7 +33,9 @@ from six.moves.urllib import parse from kingbirdclient.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