Re: Ordering in the printout of a dictionary

2014-03-18 Thread Marc Christiansen
Chris Angelico ros...@gmail.com wrote: On Tue, Mar 18, 2014 at 11:32 AM, Mok-Kong Shen mok-kong.s...@t-online.de wrote: Is there a way to force a certain ordering of the printout or else somehow manage to get at least a certain stable ordering of the printout (i.e. input and output are

Re: Ordering in the printout of a dictionary

2014-03-18 Thread Chris Angelico
On Tue, Mar 18, 2014 at 6:36 PM, Marc Christiansen usenetm...@solar-empire.de wrote: I would say using pprint.pprint is even easier and it works with your failing example: pprint.pprint({True:1,Hello:2}) {True: 1, 'Hello': 2} True. I could try to say that I prefer to offer the simpler

Ordering in the printout of a dictionary

2014-03-17 Thread Mok-Kong Shen
Could someone kindly explain a phenomenon in the following where: (1) I first typed in a dictionary but got a printout in a reordered form. (2) I then typed in the reordered form but got a printout in the order that I typed in originally in (1). That is, there is no stable standard ordering.

Re: Ordering in the printout of a dictionary

2014-03-17 Thread Chris Angelico
On Tue, Mar 18, 2014 at 11:32 AM, Mok-Kong Shen mok-kong.s...@t-online.de wrote: Could someone kindly explain a phenomenon in the following where: (1) I first typed in a dictionary but got a printout in a reordered form. (2) I then typed in the reordered form but got a printout in the order

Re: Ordering in the printout of a dictionary

2014-03-17 Thread John Gordon
In mailman.8231.1395103693.18130.python-l...@python.org Chris Angelico ros...@gmail.com writes: Is there a way to force a certain ordering of the printout or else somehow manage to get at least a certain stable ordering of the printout (i.e. input and output are identical)? Yes; instead