Commit e4236bbd authored by Santi Raffa's avatar Santi Raffa Committed by Hrvoje Ribicic

FillDict: do not use exceptions for flow control

While it's generally better to beg for forgiveness than ask for
permission in Python, it's not a good idea to rely on exceptions to
model control flow, especially if the resulting code is simpler.
Signed-off-by: default avatarSanti Raffa <rsanti@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent a09639d1
......@@ -75,10 +75,8 @@ def FillDict(defaults_dict, custom_dict, skip_keys=None):
ret_dict.update(custom_dict)
if skip_keys:
for k in skip_keys:
try:
if k in ret_dict:
del ret_dict[k]
except KeyError:
pass
return ret_dict
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment