@@ -129,8 +129,8 @@ def dump(
129
129
include_attributes can be set to true. If indent is a non-negative
130
130
integer or string, then the tree will be pretty-printed with that indent
131
131
level. None (the default) selects the single line representation.
132
- If show_empty is False, then empty lists, fields that are None,
133
- and empty strings will be ommitted from the output for better readability.
132
+ If show_empty is False, then empty lists and fields that are None
133
+ will be ommitted from the output for better readability.
134
134
"""
135
135
def _format (node , level = 0 ):
136
136
if indent is not None :
@@ -156,7 +156,7 @@ def _format(node, level=0):
156
156
continue
157
157
if (
158
158
not show_empty
159
- and value in empty_values
159
+ and ( value is None or value == [])
160
160
and not isinstance (node , Constant )
161
161
):
162
162
# Special case: `Constant(value=None)`
@@ -191,7 +191,6 @@ def _format(node, level=0):
191
191
raise TypeError ('expected AST, got %r' % node .__class__ .__name__ )
192
192
if indent is not None and not isinstance (indent , str ):
193
193
indent = ' ' * indent
194
- empty_values = (None , [])
195
194
return _format (node )[0 ]
196
195
197
196
0 commit comments