Use `isinstance()` instead of `type() ==`

This commit is contained in:
Adam Goldsmith 2023-03-12 12:41:33 -04:00
parent fa4d07b628
commit ae80647870
1 changed files with 3 additions and 3 deletions

View File

@ -59,11 +59,11 @@ def normalize_value(value):
return rounded
def recursively_normalize_values(d):
if type(d) == dict:
if isinstance(d, dict):
return {key: recursively_normalize_values(value) for key, value in d.items()}
elif type(d) == list:
elif isinstance(d, list):
return [recursively_normalize_values(value) for value in d]
elif type(d) == float:
elif isinstance(d, float):
return normalize_value(d)
else:
return d