On Mon, Dec 18, 2017 at 7:41 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> > With arbitrary order, it made sense to sort, so as to always give the > same > > "pretty" representation. But now that order is "part of" the dict itself, > > it seems prettyprint should present the preserved order of the dict. > > I disagree. Many uses of dicts are still conceptually unordered, even if > the dict now preserves insertion order. For those use-cases, insertion > order is of no interest whatsoever, and sorting is still "prettier". > and many uses of dicts have "sorted" order as completely irrelevant, and sorting them arbitrarily is not necessarily pretty (you can't provide a sort key can you? -- so yes, it's arbitrary) I'm not necessarily saying we should break things, but I won't agree that pprint sorting dicts is the "right" interface for what is actually an order-preserving mapping. I would think it was only the right choice in the first place in order (get it?) to get a consistent representation, not because sorting was a good thing per se. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception chris.bar...@noaa.gov
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com