From wes.turner at gmail.com  Fri Dec 15 01:23:26 2017
From: wes.turner at gmail.com (Wes Turner)
Date: Fri, 15 Dec 2017 01:23:26 -0500
Subject: [IPython-dev] .<tab> to print all entries in sorted(dir(obj))
 behavior?
Message-ID: <CACfEFw-iH=+LQX3_G4H1oS9d61=s54ZhTvq6BcDcS0CfBQ6YhA@mail.gmail.com>

How do I / is there a way to restore the .<tab> prints all entries in
sorted(dir(obj)) behavior?

Is there a way to configure the new python-prompt-toolkit to not require
multiple keystrokes to list the inspectable API of a class or instance?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171215/070d18f1/attachment.html>

From wes.turner at gmail.com  Fri Dec 15 01:34:10 2017
From: wes.turner at gmail.com (Wes Turner)
Date: Fri, 15 Dec 2017 01:34:10 -0500
Subject: [IPython-dev] .<tab> to print all entries in sorted(dir(obj))
 behavior?
In-Reply-To: <CACfEFw-iH=+LQX3_G4H1oS9d61=s54ZhTvq6BcDcS0CfBQ6YhA@mail.gmail.com>
References: <CACfEFw-iH=+LQX3_G4H1oS9d61=s54ZhTvq6BcDcS0CfBQ6YhA@mail.gmail.com>
Message-ID: <CACfEFw8p+FyRyxKhdGoMyo=HP6RPe+d9YdRdEzLxhMKhFBMw_w@mail.gmail.com>

On Fri, Dec 15, 2017 at 1:23 AM, Wes Turner <wes.turner at gmail.com> wrote:

> How do I / is there a way to restore the .<tab> prints all entries in
> sorted(dir(obj)) behavior?
>
> Is there a way to configure the new python-prompt-toolkit to not require
> multiple keystrokes to list the inspectable API of a class or instance?
>

Is there a way to get my .inputrc readline bindings to work in IPython?
(Is there a way to restore the classic pre-python-prompt-toolkit completer
functionality with a configuration setting?)

Call me old-fashioned, but I'd rather have my .inputrc readline bindings
than these new features, TBH.

  Ctrl-[ == Ctrl-A
  Ctrl-] == Ctrl-E
  Ctrl-right
  Ctrl-left

I added this first stab at a (pseudo-stateful) parser, but it's probably
not complete and lacking test cases:

"detect key-bindings from .inputrc"
https://github.com/jonathanslenders/python-prompt-toolkit/issues/56
https://gist.github.com/westurner/0491f7e2c6d91842c3bcd3925d911ff7

In the meantime, how could one restore the classic IPCompleter or even just
rlcompleter?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171215/c8aa36f4/attachment.html>

From chris.barker at noaa.gov  Mon Dec 18 20:08:46 2017
From: chris.barker at noaa.gov (Chris Barker)
Date: Mon, 18 Dec 2017 17:08:46 -0800
Subject: [IPython-dev] display of dicts?
Message-ID: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>

As Guido has just declared that dicts will now officially preserve order:

https://mail.python.org/pipermail/python-dev/2017-December/151283.html

I was playing around  them in py3.6 ipython, and found some (to me) odd
behavior:

In [1]: d = {'one':1, 'two':2, 'three':3}

In [2]: d
Out[2]: {'one': 1, 'three': 3, 'two': 2}

Hmm -- order does not appear to be preserved.

But then:

In [3]: str(d)
Out[3]: "{'one': 1, 'two': 2, 'three': 3}"

In [4]: repr(d)
Out[4]: "{'one': 1, 'two': 2, 'three': 3}"

In [5]: d.values()
Out[5]: dict_values([1, 2, 3])

In [6]: d.keys()
Out[6]: dict_keys(['one', 'two', 'three'])

In [7]: d.items()
Out[7]: dict_items([('one', 1), ('two', 2), ('three', 3)])

Order IS preserved.

So presumably iPython is calling sorted() or some such when displaying a
dict.

Is that that case? Is that documented anywhere?? I can't find it.

And with Python >= 3.6, dict order is preserved, so it would probably be
better to NOT mess with dict order when displaying them in iPython.

SIDE NOTE:

I had a bit of trouble finding this mailing list -- google still points to
the old ones on scipy.org. -- maybe we can put a note on the home page of
those lists that they are been moved??

(I only noticed, 'cause the archives of those stop last March)

-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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171218/63719b6f/attachment.html>

From nathan12343 at gmail.com  Mon Dec 18 20:40:02 2017
From: nathan12343 at gmail.com (Nathan Goldbaum)
Date: Mon, 18 Dec 2017 19:40:02 -0600
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
Message-ID: <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>

IPython does use pretty-printing by default. You can control it with the
%pprint magic, in your IPython configuration, with the
PlainTextFormatter.pprint option, or with the --pprint command line
argument when starting IPython.

http://ipython.readthedocs.io/en/stable/config/options/terminal.html#configtrait-PlainTextFormatter.pprint



On Mon, Dec 18, 2017 at 7:08 PM, Chris Barker <chris.barker at noaa.gov> wrote:

> As Guido has just declared that dicts will now officially preserve order:
>
> https://mail.python.org/pipermail/python-dev/2017-December/151283.html
>
> I was playing around  them in py3.6 ipython, and found some (to me) odd
> behavior:
>
> In [1]: d = {'one':1, 'two':2, 'three':3}
>
> In [2]: d
> Out[2]: {'one': 1, 'three': 3, 'two': 2}
>
> Hmm -- order does not appear to be preserved.
>
> But then:
>
> In [3]: str(d)
> Out[3]: "{'one': 1, 'two': 2, 'three': 3}"
>
> In [4]: repr(d)
> Out[4]: "{'one': 1, 'two': 2, 'three': 3}"
>
> In [5]: d.values()
> Out[5]: dict_values([1, 2, 3])
>
> In [6]: d.keys()
> Out[6]: dict_keys(['one', 'two', 'three'])
>
> In [7]: d.items()
> Out[7]: dict_items([('one', 1), ('two', 2), ('three', 3)])
>
> Order IS preserved.
>
> So presumably iPython is calling sorted() or some such when displaying a
> dict.
>
> Is that that case? Is that documented anywhere?? I can't find it.
>
> And with Python >= 3.6, dict order is preserved, so it would probably be
> better to NOT mess with dict order when displaying them in iPython.
>
> SIDE NOTE:
>
> I had a bit of trouble finding this mailing list -- google still points to
> the old ones on scipy.org. -- maybe we can put a note on the home page of
> those lists that they are been moved??
>
> (I only noticed, 'cause the archives of those stop last March)
>
> -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.Barker at noaa.gov
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171218/7acbcb66/attachment.html>

From chris.barker at noaa.gov  Mon Dec 18 20:56:56 2017
From: chris.barker at noaa.gov (Chris Barker)
Date: Mon, 18 Dec 2017 17:56:56 -0800
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
Message-ID: <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>

Thanks Nathan,

And to confirm, this is the stdlib's pprint module, yes?

(which does seem to show the same behavior)

-CHB



On Mon, Dec 18, 2017 at 5:40 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> IPython does use pretty-printing by default. You can control it with the
> %pprint magic, in your IPython configuration, with the
> PlainTextFormatter.pprint option, or with the --pprint command line
> argument when starting IPython.
>
> http://ipython.readthedocs.io/en/stable/config/options/
> terminal.html#configtrait-PlainTextFormatter.pprint
>
>
>
> On Mon, Dec 18, 2017 at 7:08 PM, Chris Barker <chris.barker at noaa.gov>
> wrote:
>
>> As Guido has just declared that dicts will now officially preserve order:
>>
>> https://mail.python.org/pipermail/python-dev/2017-December/151283.html
>>
>> I was playing around  them in py3.6 ipython, and found some (to me) odd
>> behavior:
>>
>> In [1]: d = {'one':1, 'two':2, 'three':3}
>>
>> In [2]: d
>> Out[2]: {'one': 1, 'three': 3, 'two': 2}
>>
>> Hmm -- order does not appear to be preserved.
>>
>> But then:
>>
>> In [3]: str(d)
>> Out[3]: "{'one': 1, 'two': 2, 'three': 3}"
>>
>> In [4]: repr(d)
>> Out[4]: "{'one': 1, 'two': 2, 'three': 3}"
>>
>> In [5]: d.values()
>> Out[5]: dict_values([1, 2, 3])
>>
>> In [6]: d.keys()
>> Out[6]: dict_keys(['one', 'two', 'three'])
>>
>> In [7]: d.items()
>> Out[7]: dict_items([('one', 1), ('two', 2), ('three', 3)])
>>
>> Order IS preserved.
>>
>> So presumably iPython is calling sorted() or some such when displaying a
>> dict.
>>
>> Is that that case? Is that documented anywhere?? I can't find it.
>>
>> And with Python >= 3.6, dict order is preserved, so it would probably be
>> better to NOT mess with dict order when displaying them in iPython.
>>
>> SIDE NOTE:
>>
>> I had a bit of trouble finding this mailing list -- google still points
>> to the old ones on scipy.org. -- maybe we can put a note on the home
>> page of those lists that they are been moved??
>>
>> (I only noticed, 'cause the archives of those stop last March)
>>
>> -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.Barker at noaa.gov
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at python.org
>> https://mail.python.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev
>
>


-- 

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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171218/81e2786c/attachment-0001.html>

From nathan12343 at gmail.com  Mon Dec 18 22:04:31 2017
From: nathan12343 at gmail.com (Nathan Goldbaum)
Date: Mon, 18 Dec 2017 21:04:31 -0600
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
Message-ID: <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>

Nope, I believe it's this:
https://github.com/ipython/ipython/blob/dc9d1c679424589480bb83af64aa5ee21031d311/IPython/lib/pretty.py

On Mon, Dec 18, 2017 at 7:56 PM, Chris Barker <chris.barker at noaa.gov> wrote:

> Thanks Nathan,
>
> And to confirm, this is the stdlib's pprint module, yes?
>
> (which does seem to show the same behavior)
>
> -CHB
>
>
>
> On Mon, Dec 18, 2017 at 5:40 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> IPython does use pretty-printing by default. You can control it with the
>> %pprint magic, in your IPython configuration, with the
>> PlainTextFormatter.pprint option, or with the --pprint command line
>> argument when starting IPython.
>>
>> http://ipython.readthedocs.io/en/stable/config/options/termi
>> nal.html#configtrait-PlainTextFormatter.pprint
>>
>>
>>
>> On Mon, Dec 18, 2017 at 7:08 PM, Chris Barker <chris.barker at noaa.gov>
>> wrote:
>>
>>> As Guido has just declared that dicts will now officially preserve order:
>>>
>>> https://mail.python.org/pipermail/python-dev/2017-December/151283.html
>>>
>>> I was playing around  them in py3.6 ipython, and found some (to me) odd
>>> behavior:
>>>
>>> In [1]: d = {'one':1, 'two':2, 'three':3}
>>>
>>> In [2]: d
>>> Out[2]: {'one': 1, 'three': 3, 'two': 2}
>>>
>>> Hmm -- order does not appear to be preserved.
>>>
>>> But then:
>>>
>>> In [3]: str(d)
>>> Out[3]: "{'one': 1, 'two': 2, 'three': 3}"
>>>
>>> In [4]: repr(d)
>>> Out[4]: "{'one': 1, 'two': 2, 'three': 3}"
>>>
>>> In [5]: d.values()
>>> Out[5]: dict_values([1, 2, 3])
>>>
>>> In [6]: d.keys()
>>> Out[6]: dict_keys(['one', 'two', 'three'])
>>>
>>> In [7]: d.items()
>>> Out[7]: dict_items([('one', 1), ('two', 2), ('three', 3)])
>>>
>>> Order IS preserved.
>>>
>>> So presumably iPython is calling sorted() or some such when displaying a
>>> dict.
>>>
>>> Is that that case? Is that documented anywhere?? I can't find it.
>>>
>>> And with Python >= 3.6, dict order is preserved, so it would probably be
>>> better to NOT mess with dict order when displaying them in iPython.
>>>
>>> SIDE NOTE:
>>>
>>> I had a bit of trouble finding this mailing list -- google still points
>>> to the old ones on scipy.org. -- maybe we can put a note on the home
>>> page of those lists that they are been moved??
>>>
>>> (I only noticed, 'cause the archives of those stop last March)
>>>
>>> -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.Barker at noaa.gov
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at python.org
>>> https://mail.python.org/mailman/listinfo/ipython-dev
>>>
>>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at python.org
>> https://mail.python.org/mailman/listinfo/ipython-dev
>>
>>
>
>
> --
>
> 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.Barker at noaa.gov
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171218/84c3ef86/attachment.html>

From chris.barker at noaa.gov  Mon Dec 18 23:19:57 2017
From: chris.barker at noaa.gov (Chris Barker)
Date: Mon, 18 Dec 2017 20:19:57 -0800
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
Message-ID: <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>

On Mon, Dec 18, 2017 at 7:04 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> Nope, I believe it's this: https://github.com/ipython/ipython/blob/
> dc9d1c679424589480bb83af64aa5ee21031d311/IPython/lib/pretty.py
>

I see, thanks! Though it does have the same behavior of sorting dicts --
you can see that in:

``_dict_pprinter_factory``

However as of cPYthon 3.6, and officially as of 3.7, dicts will maintain
their insertion order.

So we should probably remove the sorting from the _dict_pprinter_factory.

-CHB




>
>
> On Mon, Dec 18, 2017 at 7:56 PM, Chris Barker <chris.barker at noaa.gov>
> wrote:
>
>> Thanks Nathan,
>>
>> And to confirm, this is the stdlib's pprint module, yes?
>>
>> (which does seem to show the same behavior)
>>
>> -CHB
>>
>>
>>
>> On Mon, Dec 18, 2017 at 5:40 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>> wrote:
>>
>>> IPython does use pretty-printing by default. You can control it with the
>>> %pprint magic, in your IPython configuration, with the
>>> PlainTextFormatter.pprint option, or with the --pprint command line
>>> argument when starting IPython.
>>>
>>> http://ipython.readthedocs.io/en/stable/config/options/termi
>>> nal.html#configtrait-PlainTextFormatter.pprint
>>>
>>>
>>>
>>> On Mon, Dec 18, 2017 at 7:08 PM, Chris Barker <chris.barker at noaa.gov>
>>> wrote:
>>>
>>>> As Guido has just declared that dicts will now officially preserve
>>>> order:
>>>>
>>>> https://mail.python.org/pipermail/python-dev/2017-December/151283.html
>>>>
>>>> I was playing around  them in py3.6 ipython, and found some (to me) odd
>>>> behavior:
>>>>
>>>> In [1]: d = {'one':1, 'two':2, 'three':3}
>>>>
>>>> In [2]: d
>>>> Out[2]: {'one': 1, 'three': 3, 'two': 2}
>>>>
>>>> Hmm -- order does not appear to be preserved.
>>>>
>>>> But then:
>>>>
>>>> In [3]: str(d)
>>>> Out[3]: "{'one': 1, 'two': 2, 'three': 3}"
>>>>
>>>> In [4]: repr(d)
>>>> Out[4]: "{'one': 1, 'two': 2, 'three': 3}"
>>>>
>>>> In [5]: d.values()
>>>> Out[5]: dict_values([1, 2, 3])
>>>>
>>>> In [6]: d.keys()
>>>> Out[6]: dict_keys(['one', 'two', 'three'])
>>>>
>>>> In [7]: d.items()
>>>> Out[7]: dict_items([('one', 1), ('two', 2), ('three', 3)])
>>>>
>>>> Order IS preserved.
>>>>
>>>> So presumably iPython is calling sorted() or some such when displaying
>>>> a dict.
>>>>
>>>> Is that that case? Is that documented anywhere?? I can't find it.
>>>>
>>>> And with Python >= 3.6, dict order is preserved, so it would probably
>>>> be better to NOT mess with dict order when displaying them in iPython.
>>>>
>>>> SIDE NOTE:
>>>>
>>>> I had a bit of trouble finding this mailing list -- google still points
>>>> to the old ones on scipy.org. -- maybe we can put a note on the home
>>>> page of those lists that they are been moved??
>>>>
>>>> (I only noticed, 'cause the archives of those stop last March)
>>>>
>>>> -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.Barker at noaa.gov
>>>>
>>>> _______________________________________________
>>>> IPython-dev mailing list
>>>> IPython-dev at python.org
>>>> https://mail.python.org/mailman/listinfo/ipython-dev
>>>>
>>>>
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at python.org
>>> https://mail.python.org/mailman/listinfo/ipython-dev
>>>
>>>
>>
>>
>> --
>>
>> 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.Barker at noaa.gov
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at python.org
>> https://mail.python.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev
>
>


-- 

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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171218/51f2e501/attachment-0001.html>

From takowl at gmail.com  Tue Dec 19 06:21:53 2017
From: takowl at gmail.com (Thomas Kluyver)
Date: Tue, 19 Dec 2017 11:21:53 +0000
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
Message-ID: <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>

I think this is a tricky one, as the discussion on Python-dev is finding.
Removing the sorting makes it easier to explain how dictionaries now work.
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.

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.

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

>
>
> On Mon, Dec 18, 2017 at 7:04 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>> Nope, I believe it's this: https://github.com/ipython/ipy
>> thon/blob/dc9d1c679424589480bb83af64aa5ee21031d311/IPython/lib/pretty.py
>>
>
> I see, thanks! Though it does have the same behavior of sorting dicts --
> you can see that in:
>
> ``_dict_pprinter_factory``
>
> However as of cPYthon 3.6, and officially as of 3.7, dicts will maintain
> their insertion order.
>
> So we should probably remove the sorting from the _dict_pprinter_factory.
>
> -CHB
>
>
>
>
>>
>>
>> On Mon, Dec 18, 2017 at 7:56 PM, Chris Barker <chris.barker at noaa.gov>
>> wrote:
>>
>>> Thanks Nathan,
>>>
>>> And to confirm, this is the stdlib's pprint module, yes?
>>>
>>> (which does seem to show the same behavior)
>>>
>>> -CHB
>>>
>>>
>>>
>>> On Mon, Dec 18, 2017 at 5:40 PM, Nathan Goldbaum <nathan12343 at gmail.com>
>>> wrote:
>>>
>>>> IPython does use pretty-printing by default. You can control it with
>>>> the %pprint magic, in your IPython configuration, with the
>>>> PlainTextFormatter.pprint option, or with the --pprint command line
>>>> argument when starting IPython.
>>>>
>>>> http://ipython.readthedocs.io/en/stable/config/options/termi
>>>> nal.html#configtrait-PlainTextFormatter.pprint
>>>>
>>>>
>>>>
>>>> On Mon, Dec 18, 2017 at 7:08 PM, Chris Barker <chris.barker at noaa.gov>
>>>> wrote:
>>>>
>>>>> As Guido has just declared that dicts will now officially preserve
>>>>> order:
>>>>>
>>>>> https://mail.python.org/pipermail/python-dev/2017-December/151283.html
>>>>>
>>>>> I was playing around  them in py3.6 ipython, and found some (to me)
>>>>> odd behavior:
>>>>>
>>>>> In [1]: d = {'one':1, 'two':2, 'three':3}
>>>>>
>>>>> In [2]: d
>>>>> Out[2]: {'one': 1, 'three': 3, 'two': 2}
>>>>>
>>>>> Hmm -- order does not appear to be preserved.
>>>>>
>>>>> But then:
>>>>>
>>>>> In [3]: str(d)
>>>>> Out[3]: "{'one': 1, 'two': 2, 'three': 3}"
>>>>>
>>>>> In [4]: repr(d)
>>>>> Out[4]: "{'one': 1, 'two': 2, 'three': 3}"
>>>>>
>>>>> In [5]: d.values()
>>>>> Out[5]: dict_values([1, 2, 3])
>>>>>
>>>>> In [6]: d.keys()
>>>>> Out[6]: dict_keys(['one', 'two', 'three'])
>>>>>
>>>>> In [7]: d.items()
>>>>> Out[7]: dict_items([('one', 1), ('two', 2), ('three', 3)])
>>>>>
>>>>> Order IS preserved.
>>>>>
>>>>> So presumably iPython is calling sorted() or some such when displaying
>>>>> a dict.
>>>>>
>>>>> Is that that case? Is that documented anywhere?? I can't find it.
>>>>>
>>>>> And with Python >= 3.6, dict order is preserved, so it would probably
>>>>> be better to NOT mess with dict order when displaying them in iPython.
>>>>>
>>>>> SIDE NOTE:
>>>>>
>>>>> I had a bit of trouble finding this mailing list -- google still
>>>>> points to the old ones on scipy.org. -- maybe we can put a note on
>>>>> the home page of those lists that they are been moved??
>>>>>
>>>>> (I only noticed, 'cause the archives of those stop last March)
>>>>>
>>>>> -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.Barker at noaa.gov
>>>>>
>>>>> _______________________________________________
>>>>> IPython-dev mailing list
>>>>> IPython-dev at python.org
>>>>> https://mail.python.org/mailman/listinfo/ipython-dev
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> IPython-dev mailing list
>>>> IPython-dev at python.org
>>>> https://mail.python.org/mailman/listinfo/ipython-dev
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> 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.Barker at noaa.gov
>>>
>>> _______________________________________________
>>> IPython-dev mailing list
>>> IPython-dev at python.org
>>> https://mail.python.org/mailman/listinfo/ipython-dev
>>>
>>>
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at python.org
>> https://mail.python.org/mailman/listinfo/ipython-dev
>>
>>
>
>
> --
>
> 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.Barker at noaa.gov
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/54810a0d/attachment.html>

From chris.barker at noaa.gov  Tue Dec 19 10:37:37 2017
From: chris.barker at noaa.gov (Chris Barker - NOAA Federal)
Date: Tue, 19 Dec 2017 07:37:37 -0800
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
Message-ID: <4573660518963752835@unknownmsgid>

> 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

From takowl at gmail.com  Tue Dec 19 10:45:59 2017
From: takowl at gmail.com (Thomas Kluyver)
Date: Tue, 19 Dec 2017 15:45:59 +0000
Subject: [IPython-dev] display of dicts?
In-Reply-To: <4573660518963752835@unknownmsgid>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
Message-ID: <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>

On 19 December 2017 at 15:37, Chris Barker - NOAA Federal <
chris.barker at noaa.gov> wrote:

> > 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.
>

I think there's less danger of us breaking someone's *code* that relies on
dictionary presentation. But it's more important for us to think about
what's useful for human interpretation, since IPython is all about the
interface.


> > 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.
>

I disagree with that. Consistency is part of it, but I think the sorting is
often helpful in itself. It's much easier to see if the dictionary has a
key 'foo' if it's shown in alphabetical order than if it's not.

The new dict also only gives you consistency if the data going into it is
consistently ordered. If you are building a dictionary of filenames with
os.listdir(), for example, order is not guaranteed.

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

From chris.barker at noaa.gov  Tue Dec 19 12:24:24 2017
From: chris.barker at noaa.gov (Chris Barker)
Date: Tue, 19 Dec 2017 09:24:24 -0800
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
 <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
Message-ID: <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>

On Tue, Dec 19, 2017 at 7:45 AM, Thomas Kluyver <takowl at gmail.com> wrote:

> I think there's less danger of us breaking someone's *code* that relies on
> dictionary presentation. But it's more important for us to think about
> what's useful for human interpretation, since IPython is all about the
> interface.
>

exactly.


> I disagree with that. Consistency is part of it, but I think the sorting
>> is often helpful in itself. It's much easier to see if the dictionary has a
>> key 'foo' if it's shown in alphabetical order than if it's not.
>>
>
> The new dict also only gives you consistency if the data going into it is
> consistently ordered. If you are building a dictionary of filenames with
> os.listdir(), for example, order is not guaranteed.
>

but whether default sort order of the keys is meaningful is a happy
coincidence -- if the keys happen to be strings for which alphabetization
makes sense, then great. If they are anything else, then not so great.

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

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

In python 2.7:


In [*1*]: d = {"one": 1, "two": 2, "three": 3}


In [*2*]: d

Out[*2*]: {'one': 1, 'three': 3, 'two': 2}


In [*3*]: d.keys()

Out[*3*]: ['three', 'two', 'one']

Interesting that the display version is different than the d.keys() version
-- but I just thought that was a nice demo of "dicts are arbitrary order"

Then, in Python3.6, which I am now using for teaching:

In [*1*]: d = {"one": 1, "two": 2, "three": 3}


In [*2*]: d

Out[*2*]: {'one': 1, 'three': 3, 'two': 2}


In [*3*]: d.keys()

Out[*3*]: dict_keys(['one', 'two', 'three'])


In [*4*]: print(d)

{'one': 1, 'two': 2, 'three': 3}

Huh? d.keys() is preserving order, print is preserving order, but plain
display is not. it took me some time to realize that the display order was
alphabetical, and then I figured that iPython must be sorting them, which
then led me to the fact that the stdlib pprint sorts them too.

I have been suing iPython for many years, and had never noticed that
display used something other than "str" or "repr", nor that pprint sorted
dicts.

Still not sure if we should change it, but I don't think sorting dicts
based on default sort of keys is an obviously "best" way to present a dict.

-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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/e81a2c17/attachment.html>

From takowl at gmail.com  Tue Dec 19 12:37:55 2017
From: takowl at gmail.com (Thomas Kluyver)
Date: Tue, 19 Dec 2017 17:37:55 +0000
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
 <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
 <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>
Message-ID: <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>

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>

From steve at holdenweb.com  Tue Dec 19 12:50:28 2017
From: steve at holdenweb.com (Steve Holden)
Date: Tue, 19 Dec 2017 17:50:28 +0000
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
 <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
 <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>
 <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>
Message-ID: <CAMofdRAxKn5vWQeGifUvdHd=vRQQwHKVxe_1TGTm21Cr=c0Vig@mail.gmail.com>

On Tue, Dec 19, 2017 at 5:37 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> 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.
>

?What about adding a "sorted" method to dicts that produces a dict with the
same keys but the keys inserted ?in sorted order?

regards
 Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/c3a3cad0/attachment.html>

From chris.barker at noaa.gov  Tue Dec 19 12:51:32 2017
From: chris.barker at noaa.gov (Chris Barker)
Date: Tue, 19 Dec 2017 09:51:32 -0800
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
 <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
 <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>
 <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>
Message-ID: <CALGmxEJ_iuzyjx9o1Z8mUEH16PFixRbr_2bMXJ__vmtxtyGddA@mail.gmail.com>

On Tue, Dec 19, 2017 at 9:37 AM, Thomas Kluyver <takowl at gmail.com> wrote:

> 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.
>

Sounds like a good plan. while we're at it -- could we add a way to specify
a sort key function?

-CHB


-- 

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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/0857c491/attachment.html>

From chris.barker at noaa.gov  Tue Dec 19 12:55:34 2017
From: chris.barker at noaa.gov (Chris Barker)
Date: Tue, 19 Dec 2017 09:55:34 -0800
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CAMofdRAxKn5vWQeGifUvdHd=vRQQwHKVxe_1TGTm21Cr=c0Vig@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
 <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
 <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>
 <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>
 <CAMofdRAxKn5vWQeGifUvdHd=vRQQwHKVxe_1TGTm21Cr=c0Vig@mail.gmail.com>
Message-ID: <CALGmxEKFr_Jb28peJPGnNV=KdzpqyESFUi5hyPtPbsXceWPm7w@mail.gmail.com>

On Tue, Dec 19, 2017 at 9:50 AM, Steve Holden <steve at holdenweb.com> wrote:

>
> ?What about adding a "sorted" method to dicts that produces a dict with
> the same keys but the keys inserted ?in sorted order?
>

That would be a job for python-dev, yes?

And maybe .sort() that sorts in place instead -- similar to lists.

Too bad that the plain sorted() function only gives you the keys.. though
there is

dict(sorted(d.items()))


to get a sorted dict.


-CHB

-- 

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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/c9702c17/attachment.html>

From steve at holdenweb.com  Tue Dec 19 12:58:15 2017
From: steve at holdenweb.com (Steve Holden)
Date: Tue, 19 Dec 2017 17:58:15 +0000
Subject: [IPython-dev] display of dicts?
In-Reply-To: <CALGmxEKFr_Jb28peJPGnNV=KdzpqyESFUi5hyPtPbsXceWPm7w@mail.gmail.com>
References: <CALGmxEKCqXG67nBSqvBE=UjOgu5TO_8Fmtxay_=zsiH3NmU3rg@mail.gmail.com>
 <CAJXewOk64cQ3MvSX6yTGDQT2W-gXybbUfLOa5vD4wfqH3tRGeQ@mail.gmail.com>
 <CALGmxELYnEfJt7rUxDKVyQoXV+2fa4v0r52PT4CVXsTT+KcdNA@mail.gmail.com>
 <CAJXewOkjmob=V_6rN3sT2qnsqvOSE7ZNvSb6rQfeBDyBMkGxuA@mail.gmail.com>
 <CALGmxEJwAgKose6_NwS9PojPd=rLNam73gB3ucqKsxiMNhZ0+w@mail.gmail.com>
 <CAOvn4qiCwT1TkUvEDL6HowW7j=NPZtcpn1H1WG-Js--xZ-CbtQ@mail.gmail.com>
 <4573660518963752835@unknownmsgid>
 <CAOvn4qjT9S750YfAKi_mDAxFkYei_-c+-JZLC8Vk57a50RESng@mail.gmail.com>
 <CALGmxE+BApDuX8EWX1XqVNShXWVx91MxyVAJb8QeW1kJWh6OWg@mail.gmail.com>
 <CAOvn4qi8tp=P33ehyLk2i0D7pigeU1WTGKC9snWO9HuFSptXQQ@mail.gmail.com>
 <CAMofdRAxKn5vWQeGifUvdHd=vRQQwHKVxe_1TGTm21Cr=c0Vig@mail.gmail.com>
 <CALGmxEKFr_Jb28peJPGnNV=KdzpqyESFUi5hyPtPbsXceWPm7w@mail.gmail.com>
Message-ID: <CAMofdRAUCFDtXT=PUp3pKkOn-8Z=VfaZBKUrsQqE48Wkwbs=Bg@mail.gmail.com>

I've just "run it up the flagpole" on python-dev, so we'll see if anyone
salutes.

Steve Holden

On Tue, Dec 19, 2017 at 5:55 PM, Chris Barker <chris.barker at noaa.gov> wrote:

> On Tue, Dec 19, 2017 at 9:50 AM, Steve Holden <steve at holdenweb.com> wrote:
>
>>
>> ?What about adding a "sorted" method to dicts that produces a dict with
>> the same keys but the keys inserted ?in sorted order?
>>
>
> That would be a job for python-dev, yes?
>
> And maybe .sort() that sorts in place instead -- similar to lists.
>
> Too bad that the plain sorted() function only gives you the keys.. though
> there is
>
> dict(sorted(d.items()))
>
>
> to get a sorted dict.
>
>
> -CHB
>
> --
>
> 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.Barker at noaa.gov
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at python.org
> https://mail.python.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20171219/e89f38e6/attachment-0001.html>