Issue23775
Created on 2015-03-25 07:54 by serhiy.storchaka, last changed 2015-03-26 06:57 by serhiy.storchaka. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| pprint_ordered_dict.patch | serhiy.storchaka, 2015-03-25 07:54 | review | ||
| Messages (4) | |||
|---|---|---|---|
| msg239234 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-03-25 07:54 | |
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)])
|
|||
| msg239285 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2015-03-25 22:54 | |
LGTM. Added minor comments on Rietveld. |
|||
| msg239308 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-03-26 06:52 | |
New changeset afc21da5935f by Serhiy Storchaka in branch 'default': Issue #23775: pprint() of OrderedDict now outputs the same representation https://hg.python.org/cpython/rev/afc21da5935f |
|||
| msg239309 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-03-26 06:57 | |
Thank you for your review Berker. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2015-03-26 06:57:06 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg239309 stage: commit review -> resolved |
| 2015-03-26 06:52:13 | python-dev | set | nosy:
+ python-dev messages: + msg239308 |
| 2015-03-25 22:54:40 | berker.peksag | set | nosy:
+ berker.peksag messages:
+ msg239285 |
| 2015-03-25 10:26:10 | alexei.romanov | set | nosy:
+ alexei.romanov |
| 2015-03-25 07:54:56 | serhiy.storchaka | create | |