Incompatible change discussion: Pretty printing of ordered dict.

Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Incompatible change discussion: Pretty printing of ordered dict.

Matthias Bussonnier
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Thomas Kluyver-2
I don't have a particular concrete use case, but as an experienced Python programmer who knows that dicts are conceptually unordered, I like the sorted presentation and would be sorry to lose it. It makes it easier to quickly find something in a dict if its shown in alphabetical order.

If the dict maintaining insertion order becomes a language feature rather than an implementation detail, I would favour showing that. But for now it's an implementation detail, so it shouldn't change how we think about dicts.

Thomas

On 2 August 2017 at 19:44, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev


_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Dirk Boonzajer Flaes

I am pretty experienced with numpy but I wasn't with using dicts, and this 'feature" confused me a lot! I would  be all for removing the sorting to make it clear that the order is not preserved, although it does make displaying dicts a bit less clear.

On Aug 2, 2017 10:33 PM, "Thomas Kluyver" <[hidden email]> wrote:
I don't have a particular concrete use case, but as an experienced Python programmer who knows that dicts are conceptually unordered, I like the sorted presentation and would be sorry to lose it. It makes it easier to quickly find something in a dict if its shown in alphabetical order.

If the dict maintaining insertion order becomes a language feature rather than an implementation detail, I would favour showing that. But for now it's an implementation detail, so it shouldn't change how we think about dicts.

Thomas

On 2 August 2017 at 19:44, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev


_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev


_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Wes Turner
In reply to this post by Matthias Bussonnier
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;IPython-dev@python.org&#39;)">IPython-dev@...
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Carl Smith

I'm with Thomas.


On Wed, 2 Aug 2017 22:30 Wes Turner, <[hidden email]> wrote:
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

MinRK
I'm pretty strongly in favor of keeping the sorting in our default pretty-printing. It's extremely valuable for interacting with dictionaries to have consistent, predictable display. There are plenty of ways to illustrate dict ordering, such as by iterating through the dict , e.g. `list(dict)`.

-Min

On Thu, Aug 3, 2017 at 6:38 PM, Carl Smith <[hidden email]> wrote:

I'm with Thomas.


On Wed, 2 Aug 2017 22:30 Wes Turner, <[hidden email]> wrote:
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev



_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Wes Turner
```python
repr(dict)

import pprint
pprint.pprint(dict)
print(pprint.pformat(dict)
```

On Friday, August 4, 2017, MinRK <[hidden email]> wrote:
I'm pretty strongly in favor of keeping the sorting in our default pretty-printing. It's extremely valuable for interacting with dictionaries to have consistent, predictable display. There are plenty of ways to illustrate dict ordering, such as by iterating through the dict , e.g. `list(dict)`.

-Min

On Thu, Aug 3, 2017 at 6:38 PM, Carl Smith <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;carl.input@gmail.com&#39;);" target="_blank">carl.input@...> wrote:

I'm with Thomas.


On Wed, 2 Aug 2017 22:30 Wes Turner, <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;wes.turner@gmail.com&#39;);" target="_blank">wes.turner@...> wrote:
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;bussonniermatthias@gmail.com&#39;);" target="_blank">bussonniermatthias@...> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
_______________________________________________
IPython-dev mailing list
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;IPython-dev@python.org&#39;);" target="_blank">IPython-dev@...
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;IPython-dev@python.org&#39;);" target="_blank">IPython-dev@...
https://mail.python.org/mailman/listinfo/ipython-dev



_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Steve Holden-5
It's always difficult to change a long-established behaviour. I'd prefer that dict  printing stayed as it is - I haven't seen many complaints so far, and as has been pointed out the key ordering is available if required.  S

Sent from my iPhone

On 4 Aug 2017, at 15:36, Wes Turner <[hidden email]> wrote:

```python
repr(dict)

import pprint
pprint.pprint(dict)
print(pprint.pformat(dict)
```

On Friday, August 4, 2017, MinRK <[hidden email]> wrote:
I'm pretty strongly in favor of keeping the sorting in our default pretty-printing. It's extremely valuable for interacting with dictionaries to have consistent, predictable display. There are plenty of ways to illustrate dict ordering, such as by iterating through the dict , e.g. `list(dict)`.

-Min

On Thu, Aug 3, 2017 at 6:38 PM, Carl Smith <<a href="javascript:_e(%7B%7D,'cvml','carl.input@gmail.com');" target="_blank">carl.input@...> wrote:

I'm with Thomas.


On Wed, 2 Aug 2017 22:30 Wes Turner, <<a href="javascript:_e(%7B%7D,'cvml','wes.turner@gmail.com');" target="_blank">wes.turner@...> wrote:
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <<a href="javascript:_e(%7B%7D,'cvml','bussonniermatthias@gmail.com');" target="_blank">bussonniermatthias@...> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
_______________________________________________
IPython-dev mailing list
<a href="javascript:_e(%7B%7D,'cvml','IPython-dev@python.org');" target="_blank">IPython-dev@...
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
<a href="javascript:_e(%7B%7D,'cvml','IPython-dev@python.org');" target="_blank">IPython-dev@...
https://mail.python.org/mailman/listinfo/ipython-dev


_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Yarko Tymciurak-2
In [16]: d = {'c':3,'b':2,'a':1}

In [17]: d
Out[17]: {'a': 1, 'b': 2, 'c': 3}

In [18]: repr(d)
Out[18]: "{'c': 3, 'b': 2, 'a': 1}"

In [19]: import pprint

In [20]: pprint.pprint(d)
{'a': 1, 'b': 2, 'c': 3}

In [21]: print(d)
{'c': 3, 'b': 2, 'a': 1}

In [22]: print(pprint.pformat(d))
{'a': 1, 'b': 2, 'c': 3}


On Fri, Aug 4, 2017 at 10:21 AM, Steve Holden <[hidden email]> wrote:
It's always difficult to change a long-established behaviour. I'd prefer that dict  printing stayed as it is - I haven't seen many complaints so far, and as has been pointed out the key ordering is available if required.  S

Sent from my iPhone

On 4 Aug 2017, at 15:36, Wes Turner <[hidden email]> wrote:

```python
repr(dict)

import pprint
pprint.pprint(dict)
print(pprint.pformat(dict)
```

On Friday, August 4, 2017, MinRK <[hidden email]> wrote:
I'm pretty strongly in favor of keeping the sorting in our default pretty-printing. It's extremely valuable for interacting with dictionaries to have consistent, predictable display. There are plenty of ways to illustrate dict ordering, such as by iterating through the dict , e.g. `list(dict)`.

-Min

On Thu, Aug 3, 2017 at 6:38 PM, Carl Smith <[hidden email]> wrote:

I'm with Thomas.


On Wed, 2 Aug 2017 22:30 Wes Turner, <[hidden email]> wrote:
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev


_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev



_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Pietro Terna
    Dear all,

    just to understand ...

    Why in Idle the result is different?

Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> d = {'c':3,'b':2,'a':1}
>>> d
{'c': 3, 'b': 2, 'a': 1}
>>>

    Best, Pietro

Il 04/08/17 20:23, Yarko Tymciurak ha scritto:
In [16]: d = {'c':3,'b':2,'a':1}

In [17]: d
Out[17]: {'a': 1, 'b': 2, 'c': 3}

In [18]: repr(d)
Out[18]: "{'c': 3, 'b': 2, 'a': 1}"

In [19]: import pprint

In [20]: pprint.pprint(d)
{'a': 1, 'b': 2, 'c': 3}

In [21]: print(d)
{'c': 3, 'b': 2, 'a': 1}

In [22]: print(pprint.pformat(d))
{'a': 1, 'b': 2, 'c': 3}


On Fri, Aug 4, 2017 at 10:21 AM, Steve Holden <[hidden email]> wrote:
It's always difficult to change a long-established behaviour. I'd prefer that dict  printing stayed as it is - I haven't seen many complaints so far, and as has been pointed out the key ordering is available if required.  S

Sent from my iPhone

On 4 Aug 2017, at 15:36, Wes Turner <[hidden email]> wrote:

```python
repr(dict)

import pprint
pprint.pprint(dict)
print(pprint.pformat(dict)
```

On Friday, August 4, 2017, MinRK <[hidden email]> wrote:
I'm pretty strongly in favor of keeping the sorting in our default pretty-printing. It's extremely valuable for interacting with dictionaries to have consistent, predictable display. There are plenty of ways to illustrate dict ordering, such as by iterating through the dict , e.g. `list(dict)`.

-Min

On Thu, Aug 3, 2017 at 6:38 PM, Carl Smith <[hidden email]> wrote:

I'm with Thomas.


On Wed, 2 Aug 2017 22:30 Wes Turner, <[hidden email]> wrote:
Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only in order to teach:

- dict
PYTHONHASHSEED / -R
- collections.OrderedDict (is backwards compatible)



On Wednesday, August 2, 2017, Matthias Bussonnier <[hidden email]> wrote:
Hi all,

As you may or may not be aware, with Python 3.6 the dictionary are
ordered by default. It is technically an implementation detail, though
some people would love for it not to.

Regardless, IPython has for a long time pretty-printed the dictionary
with _sorted_ keys, this thus prevent to teach python and show that
dictionaries maintain order. Thus there is the question of wether we
should disable sorting keys while pretty-printing.

https://github.com/ipython/ipython/issues/10110

This seem like a minor change, but I'd like to know if some of you are
_relying_ on the ordering of dict when they are printed, or have
compelling arguments against (or for) removing sorting of the keys
before pretty_printing.

If you care about the above subject, please have your voice heard in
above issue.

Thanks,
--
Matthias
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev


_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev




_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev

-- 
The world is full of interesting problems to be solved!

Home page: http://terna.to.it

Have a look to: 
http://web-prod.santafe.edu/news-center/news/dangers-simplicity-complex-world

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Thomas Kluyver-2
On 4 August 2017 at 21:48, Pietro Terna <[hidden email]> wrote:
    Why in Idle the result is different?

Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> d = {'c':3,'b':2,'a':1}
>>> d
{'c': 3, 'b': 2, 'a': 1}

IDLE displays the standard Python repr() of an object. Part of IPython is a pretty-printing system that tries to provide clearer representations of containers like dicts and lists.

Thomas

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Incompatible change discussion: Pretty printing of ordered dict.

Damián Avila
If the dict maintaining insertion order becomes a language feature rather than an implementation detail, I would favour showing that. But for now it's an implementation detail, so it shouldn't change how we think about dicts.

I agree.

2017-08-04 17:51 GMT-03:00 Thomas Kluyver <[hidden email]>:
On 4 August 2017 at 21:48, Pietro Terna <[hidden email]> wrote:
    Why in Idle the result is different?

Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> d = {'c':3,'b':2,'a':1}
>>> d
{'c': 3, 'b': 2, 'a': 1}

IDLE displays the standard Python repr() of an object. Part of IPython is a pretty-printing system that tries to provide clearer representations of containers like dicts and lists.

Thomas

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev




--
Damián Avila

_______________________________________________
IPython-dev mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/ipython-dev
Loading...