Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurances. Using the in-operator for hash lookups is faster than using .keys() http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
This commit is contained in:
parent
6a6113e951
commit
ffb80926ce
1 changed files with 2 additions and 2 deletions
|
@ -2782,11 +2782,11 @@ class GenericBsdIfconfigNetwork(Network):
|
||||||
return
|
return
|
||||||
ifinfo = interfaces[defaults['interface']]
|
ifinfo = interfaces[defaults['interface']]
|
||||||
# copy all the interface values across except addresses
|
# copy all the interface values across except addresses
|
||||||
for item in ifinfo.keys():
|
for item in ifinfo:
|
||||||
if item != 'ipv4' and item != 'ipv6':
|
if item != 'ipv4' and item != 'ipv6':
|
||||||
defaults[item] = ifinfo[item]
|
defaults[item] = ifinfo[item]
|
||||||
if len(ifinfo[ip_type]) > 0:
|
if len(ifinfo[ip_type]) > 0:
|
||||||
for item in ifinfo[ip_type][0].keys():
|
for item in ifinfo[ip_type][0]:
|
||||||
defaults[item] = ifinfo[ip_type][0][item]
|
defaults[item] = ifinfo[ip_type][0][item]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue