[issue27495] Pretty printing sorting for set and frozenset instances
Danilo J. S. Bellini
report at bugs.python.org
Wed Jul 13 13:34:36 EDT 2016
Danilo J. S. Bellini added the comment:
Wouldn't a fix for all standard collections be a fix for Python 3.5+, therefore another issue? http://bugs.python.org/issue23870
This issue is about sets/frozensets Python 3.2+, and I'm pretty sure it's backwards compatible, as I don't think any code running on Python 3.2.6 would depend on pprint randomness (how could?). Also, a multiline pprint would sort (tested with Python 3.2.6):
>>> pprint.pprint(set(string.digits), width=7)
{'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9'}
I see no reason to see a fix to this inconsistent behavior (sorting on multiline, not sorting on single line) as an enhancement just for a new Python 3.6 version. Besides being backwards compatible, the test_pprint was really verifying the order on set(range(n)) for small n, something that is already sorted by set.__repr__ but appears in test_pprint, which make me think it was intended as a pretty printer test, not as a set.__repr__ test.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27495>
_______________________________________
More information about the Python-bugs-list
mailing list