Skip to content

Commit fccf217

Browse files
committed
Merge pull request softlayer#707 from cclauss/patch-2
Simplify with a dict comprehension
2 parents 49bcdbc + ac953a6 commit fccf217

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

SoftLayer/utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,8 @@ def to_dict(self):
5959
6060
This is needed for places where strict type checking is done.
6161
"""
62-
new_dict = {}
63-
for key, val in self.items():
64-
if isinstance(val, NestedDict):
65-
new_dict[key] = val.to_dict()
66-
else:
67-
new_dict[key] = val
68-
return new_dict
62+
return {key: val.to_dict() if isinstance(val, NestedDict) else val
63+
for key, val in self.items()}
6964

7065

7166
def query_filter(query):

0 commit comments

Comments
 (0)