[IPython-dev] display of dicts?

Thomas Kluyver takowl at gmail.com
Tue Dec 19 12:37:55 EST 2017


On 19 December 2017 at 17:24, Chris Barker <chris.barker at noaa.gov> wrote:

> Granted, string keys where alphabetization makes sense are pretty darn
> common, but still a "special case"
>

I'd argue that they're common enough to be the typical case, though perhaps
my definition of 'makes sense' is a bit broader than yours. And sorting can
also make sense for numeric keys.


> In fact, I discovered this with this example, which I used in my intro to
> Python class to demonstrate dict's arbitrary order
>

I think this is exactly the tension we're facing. People teaching intro to
Python courses want to show what a dictionary *is*, and you don't want
IPython's features to obscure that. But other than learning about
dictionaries, I suspect that sorted order is useful more often than
insertion order.

I'm leaning slightly towards making insertion order the default in Python
3.7 - it will be meaningful some of the time, and it is now part of what a
dict is - but I think we should ensure the same release adds an easy way to
switch back to displaying sorted dicts.

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/004548c6/attachment-0001.html>


More information about the IPython-dev mailing list