Title: pprint.pprint does not pprint unsortable dicts in Python 3
Type: Stage:
Components: Versions: Python 3.1
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: aronacher, georg.brandl, pitrou
Priority: high Keywords:

Created on 2009-09-19 09:26 by aronacher, last changed 2009-09-20 17:11 by aronacher. This issue is now closed.

Messages (5)
msg92862 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2009-09-19 09:26
Currently pprint does not work on dicts it cannot sort.  Because in
Python 3 sorted(x.items()) is no longer guaranteed to work a new sorting
solution has to be found.
msg92868 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-09-19 13:11
A simple fix is to use key=lambda x: (id(type(x)), x).  However, that
obviously doesn't work with values of different, but orderable types.

At the moment, I don't see how the Python 2 sort could be implemented
without a cmp() argument to sorted().
msg92901 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-09-20 17:09
Is it the same as #3976?
msg92902 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2009-09-20 17:10
Yes.  Appears to be related.
msg92903 - (view) Author: Armin Ronacher (aronacher) * (Python committer) Date: 2009-09-20 17:10
Duplicate of #3976
Date User Action Args
2009-09-20 17:11:13aronachersetstatus: open -> closed
2009-09-20 17:10:54aronachersetresolution: duplicate
messages: + msg92903
2009-09-20 17:10:20aronachersetmessages: + msg92902
2009-09-20 17:09:14pitrousetnosy: + pitrou
messages: + msg92901
2009-09-19 13:11:49georg.brandlsetpriority: high
nosy: + georg.brandl
messages: + msg92868

2009-09-19 09:26:58aronachercreate