[IPython-dev] display of dicts?
Chris Barker - NOAA Federal
chris.barker at noaa.gov
Tue Dec 19 10:37:37 EST 2017
> On Dec 19, 2017, at 3:23 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>
> I think this is a tricky one, as the discussion on Python-dev is finding.
Indeed. But I think with iPython, at least it’s less likely that
people are using the pretty printed results in a meaningful way.
> But for a lot of real-world use cases, insertion order is not meaningful, and displaying a sorted dictionary is still going to be more useful.
Maybe — but for many dicts, the default sort order isn’t any better
than arbitrary anyway. In my mind, the reason to have sorted dicts for
pretty print in the first place was to get consistency— not sorting
per se. And we now get that out of the box.
> We'll probably have to make it optional, but I don't think it's at all obvious which should be the default. I think the sorting is probably preferable more of the time, but when trying to teach people about insertion order, you really don't want to have to switch to non-default behaviour.
Exactly.
+1 for making sorting non-default.
But it is a change .. maybe not worth it.
-CHB
More information about the IPython-dev
mailing list