Use `try/except KeyError` in place of `if in dict/else`

This commit is contained in:
ZyX 2013-04-10 18:09:34 +04:00
parent 716f7617c4
commit f389c43e43
1 changed files with 2 additions and 2 deletions

View File

@ -697,13 +697,13 @@ class NetworkLoadSegment(KwThreadedSegment):
total = activity
interface = name
if interface in self.interfaces:
try:
idata = self.interfaces[interface]
try:
idata['prev'] = idata['last']
except KeyError:
pass
else:
except KeyError:
idata = {}
if self.run_once:
idata['prev'] = (monotonic(), _get_bytes(interface))