Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #68494

Re: Ordering in the printout of a dictionary

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'example:': 0.03; 'failing': 0.07; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'nearest': 0.16; '{true:': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'simpler': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; 'forgot': 0.30; 'message-id:@mail.gmail.com': 0.30; 'easier': 0.31; '>>>>': 0.31; 'marc': 0.31; 'subject:the': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'fact': 0.38; 'pm,': 0.38; 'rather': 0.38; 'even': 0.60; 'hope': 0.61; 'offer': 0.62; 'reach': 0.63; 'mar': 0.68; 'hammer': 0.84; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FfOIRNFdVdXkNQoiHOpeB+OJkJ4OrZGjmY3C2VuyoUQ=; b=fvNF6JD30NwCT/Q/BodT/TG/4cAPmWeZHwT6NLVQaTnbfksmlu7HjHMc7sx1h8PCC+ tHINDatJfOgsK3zBPzqGm3CRh91RnKFtymeyvglEP9f2An0SSUtNoCiSy/sYCAriB5gz IdkzeUJmjYqayADDSJU81GdRMG/PtEDCk7rZXQD+VAuVCaYow4OD1rSkX1eG1tkI+bmf QVpi3W4rq0mU/WVRjfpVep367iEl9mlxt1HdL+NnqUfK1/cq+qFR6Xz/s0D5akuHxOiO EAJBsjDfaCrSd+sPypUFpYc2tY3ZwB+oL4jmlCRayk1RfhdFdcUE3qEvuiyHgRqK8k48 3Xmg==
MIME-Version 1.0
X-Received by 10.68.200.74 with SMTP id jq10mr320959pbc.169.1395129317507; Tue, 18 Mar 2014 00:55:17 -0700 (PDT)
In-Reply-To <cl9lva-45d.ln1@pluto.solar-empire.de>
References <lg8462$fnk$1@news.albasani.net> <mailman.8231.1395103693.18130.python-list@python.org> <cl9lva-45d.ln1@pluto.solar-empire.de>
Date Tue, 18 Mar 2014 18:55:17 +1100
Subject Re: Ordering in the printout of a dictionary
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8246.1395129321.18130.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1395129321 news.xs4all.nl 2922 [2001:888:2000:d::a6]:54334
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:68494

Show key headers only | View raw


On Tue, Mar 18, 2014 at 6:36 PM, Marc Christiansen
<usenetmail@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 approach
rather than encourage people to automatically reach for the nearest
hammer and hope it's right, but the fact is... I completely forgot
about pprint :)

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Ordering in the printout of a dictionary Mok-Kong Shen <mok-kong.shen@t-online.de> - 2014-03-18 01:32 +0100
  Re: Ordering in the printout of a dictionary Chris Angelico <rosuav@gmail.com> - 2014-03-18 11:48 +1100
    Re: Ordering in the printout of a dictionary John Gordon <gordon@panix.com> - 2014-03-18 02:56 +0000
    Re: Ordering in the printout of a dictionary Marc Christiansen <usenetmail@solar-empire.de> - 2014-03-18 08:36 +0100
      Re: Ordering in the printout of a dictionary Chris Angelico <rosuav@gmail.com> - 2014-03-18 18:55 +1100

csiph-web