diff --git a/traitsui/wx/tabular_editor.py b/traitsui/wx/tabular_editor.py index 817d29873..b7dc05684 100644 --- a/traitsui/wx/tabular_editor.py +++ b/traitsui/wx/tabular_editor.py @@ -937,7 +937,7 @@ def save_prefs(self): """ cws = self._cached_widths if cws is not None: - cws = [(None, cw)[cw >= 0] for cw in cws] + cws = [cw if cw is not None and cw >= 0 else None for cw in cws] return {"cached_widths": cws}