This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients fdrake, rhettinger, serhiy.storchaka
Date 2015-03-25.07:54:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427270096.56.0.104555413271.issue23775@psf.upfronthosting.co.za>
In-reply-to
Content
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)])
History
Date User Action Args
2015-03-25 07:54:56serhiy.storchakasetrecipients: + serhiy.storchaka, fdrake, rhettinger
2015-03-25 07:54:56serhiy.storchakasetmessageid: <1427270096.56.0.104555413271.issue23775@psf.upfronthosting.co.za>
2015-03-25 07:54:56serhiy.storchakalinkissue23775 messages
2015-03-25 07:54:56serhiy.storchakacreate