New submission from Serhiy Storchaka:
Currently pprint prints the repr of OrderedDict if it fits in one line, and
prints the repr of dict if it is wrapped.
>>> import collections, pprint
>>> pprint.pprint(collections.OrderedDict([(4, 3), (2, 1)]))
OrderedDict([(4, 3), (2, 1)])
>>> pprint.pprint(collections.OrderedDict([(4, 3), (2, 1)]), width=25)
{4: 3,
2: 1}
Proposed patch makes pprint always produce an output compatible with
OrderedDict's repr.
>>> pprint.pprint(collections.OrderedDict([(4, 3), (2, 1)]), width=25)
OrderedDict([(4, 3),
(2, 1)])
----------
assignee: serhiy.storchaka
components: Library (Lib)
files: pprint_ordered_dict.patch
keywords: patch
messages: 239234
nosy: fdrake, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Fix pprint of OrderedDict
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file38683/pprint_ordered_dict.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23775>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com