Skip to content

Commit 180b39b

Browse files
committed
Use tuple rather than or for isinstance check
Both are valid, but slightly cleaner to do it this way
1 parent 0131e0e commit 180b39b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

logstash_formatter/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ def _default_json_default(obj):
1414
Coerce everything to strings.
1515
All objects representing time get output as ISO8601.
1616
"""
17-
if isinstance(obj, datetime.datetime) or \
18-
isinstance(obj,datetime.date) or \
19-
isinstance(obj,datetime.time):
17+
if isinstance(obj, (datetime.datetime, datetime.date, datetime.time)):
2018
return obj.isoformat()
2119
else:
2220
return str(obj)

0 commit comments

Comments
 (0)