0

In IPython 6.1.0 which Python version is 3.6.2:

Python 3.6.2 (default, Aug 8 2017, 21:56:47) Type 'copyright', 'credits' or 'license' for more information IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [2]: c = {}

In [3]: c['g'] = 3

In [4]: c['a'] = 1

In [5]: c['c'] = 2

In [6]: c

Out[6]: {'a': 1, 'c': 2, 'g': 3}

and in Python 3.6.2:

Python 3.6.2 (default, Aug 8 2017, 21:56:47) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin Type "help", "copyright", "credits" or "license" for more information.

/>>> c = {}

/>>> c['g'] = 3

/>>> c['a'] = 1

/>>> c['c'] = 2

/>>> c

{'g': 3, 'a': 1, 'c': 2}

weqopy
  • 9
  • 2
  • It is because the pprint is on, and it displays the elements in alphabetical order. You can toggle that with `%pprint`. For 3.6 I think they should change this behaviour though. – ayhan Sep 13 '17 at 23:35
  • Yeah, I have seen the existing question. Thx – weqopy Sep 13 '17 at 23:41

0 Answers0