From b361f8e9bc3d50b8de49310fb198893fe152fcb3 2020-04-22 13:20:25 From: Eric Wieser Date: 2020-04-22 13:20:25 Subject: [PATCH] Keep trailing commas for tuple subclasses of length 1 --- diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py index ae2efd0..921c19d 100644 --- a/IPython/lib/pretty.py +++ b/IPython/lib/pretty.py @@ -638,7 +638,7 @@ def _seq_pprinter_factory(start, end): p.text(',') p.breakable() p.pretty(x) - if len(obj) == 1 and type(obj) is tuple: + if len(obj) == 1 and isinstance(obj, tuple): # Special case for 1-item tuples. p.text(',') p.end_group(step, end)