Skip to content

Commit

Permalink
remove unchanging boolean DICT_IS_ORDERED and dependent unreachable code
Browse files Browse the repository at this point in the history
  • Loading branch information
petevdp committed Nov 21, 2019
1 parent 17e9ca6 commit dffa2c3
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions IPython/lib/pretty.py
Expand Up @@ -97,9 +97,6 @@ def _repr_pretty_(self, p, cycle):


MAX_SEQ_LENGTH = 1000
# The language spec says that dicts preserve order from 3.7, but CPython
# does so from 3.6, so it seems likely that people will expect that.
DICT_IS_ORDERED = True
_re_pattern_type = type(re.compile(''))

def _safe_getattr(obj, attr, default=None):
Expand Down Expand Up @@ -606,11 +603,6 @@ def inner(obj, p, cycle):
step = len(start)
p.begin_group(step, start)
keys = obj.keys()
# if dict isn't large enough to be truncated, sort keys before displaying
# From Python 3.7, dicts preserve order by definition, so we don't sort.
if not DICT_IS_ORDERED \
and not (p.max_seq_length and len(obj) >= p.max_seq_length):
keys = _sorted_for_pprint(keys)
for idx, key in p._enumerate(keys):
if idx:
p.text(',')
Expand Down

0 comments on commit dffa2c3

Please sign in to comment.