Avoid use xx=[] for parameter initial value
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 [] more information:http://effbot.org/zone/default-values.htm Change-Id: Ia89b9741731c07d8bf08691a1c6544742625cad6
This commit is contained in:
parent
c22d37b51c
commit
12be3210eb
|
@ -24,7 +24,9 @@ def get_version_map():
|
|||
}
|
||||
|
||||
|
||||
def assert_has_keys(dict, required=[], optional=[]):
|
||||
def assert_has_keys(dict, required=None, optional=None):
|
||||
required = required or []
|
||||
optional = optional or []
|
||||
keys = dict.keys()
|
||||
for k in required:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue