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


Groups > comp.lang.python > #20078

Re: frozendict

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed10.multikabel.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <nathan.alexander.rice@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.044
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'order?': 0.09; 'tuple': 0.09; 'am,': 0.12; 'tuple,': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'insert': 0.19; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'cc:2**0': 0.26; 'import': 0.27; 'putting': 0.28; 'order.': 0.28; 'message- id:@mail.gmail.com': 0.29; 'fine.': 0.29; 'cc:addr:python.org': 0.29; 'booth': 0.30; 'thu,': 0.32; 'sort': 0.33; 'it.': 0.33; 'too': 0.33; 'anything': 0.34; 'identical': 0.34; 'sets': 0.35; 'received:209.85.160': 0.36; 'two': 0.36; 'created': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'useful': 0.38; 'received:209.85.160.46': 0.39; 'received:mail- pw0-f46.google.com': 0.39; 'received:209': 0.39; 'put': 0.40; 'one,': 0.40; 'hope': 0.61; 'nathan': 0.84; 'items,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=cTHi+czpm1nzCThjOkPldjNAc4iv1QU5XnAaXOZMPyc=; b=Yip288x2RueGPovXIX1WLBhOMuJD4CDjT8B/TerSAMN9H7CNTDESnUjJLNzxdZguvu 9hkEaSMRPbWPpPYRyXD1G262hwyXMzwRCFYJZ+0a8uWeEsMXDXWrsE18Mw2bBj965Vni v3eOIY2gVVr33l8T6pirKUJbEBNN03AX53nfE=
MIME-Version 1.0
In-Reply-To <Xns9FF46B35EDFF9duncanbooth@127.0.0.1>
References <4F332007.9080800@wisc.edu> <jgv9ps$35g$1@dough.gmane.org> <mailman.5558.1328759017.27778.python-list@python.org> <Xns9FF46B35EDFF9duncanbooth@127.0.0.1>
Date Thu, 9 Feb 2012 09:36:12 -0500
Subject Re: frozendict
From Nathan Rice <nathan.alexander.rice@gmail.com>
To duncan.booth@suttoncourtenay.org.uk
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5588.1328798176.27778.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328798176 news.xs4all.nl 6953 [2001:888:2000:d::a6]:39521
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:20078

Show key headers only | View raw


On Thu, Feb 9, 2012 at 5:33 AM, Duncan Booth
<duncan.booth@invalid.invalid> wrote:
> Nathan Rice <nathan.alexander.rice@gmail.com> wrote:
>
>> I put dicts in sets all the time.  I just tuple the items, but that
>> means you have to re-dict it on the way out to do anything useful with
>> it.  I am too lazy to write a frozendict or import one, but I would
>> use it if it was a builtin.
>>
> I hope you sort the items before putting them in a tuple, otherwise how do
> you handle two identical dicts that return their items in a different
> order?

Two dicts created from the same inputs will return items in the same
arbitrary order.  As long as you don't insert or delete a key you're
fine.


Nathan

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


Thread

Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-08 22:43 -0500
  Re: frozendict Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-09 10:33 +0000
    Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 09:36 -0500
      Re: frozendict Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-09 14:52 +0000
        Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 10:19 -0500
          Re: frozendict Duncan Booth <duncan.booth@invalid.invalid> - 2012-02-09 18:47 +0000
        Re: frozendict Ian Kelly <ian.g.kelly@gmail.com> - 2012-02-09 09:35 -0700
          Re: frozendict Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-10 01:24 +0000
            Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 21:30 -0500
            Re: frozendict Terry Reedy <tjreedy@udel.edu> - 2012-02-09 22:33 -0500
            Re: frozendict Chris Angelico <rosuav@gmail.com> - 2012-02-10 21:08 +1100
            Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-10 11:53 -0500
            Re: frozendict Chris Rebert <clp2@rebertia.com> - 2012-02-10 09:00 -0800
            Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-10 13:14 -0500
              Re: frozendict John Nagle <nagle@animats.com> - 2012-02-10 10:57 -0800
                Re: frozendict 88888 Dihedral <dihedral88888@googlemail.com> - 2012-02-10 21:52 -0800
                Re: frozendict John Nagle <nagle@animats.com> - 2012-02-13 13:15 -0800
        Re: frozendict Nathan Rice <nathan.alexander.rice@gmail.com> - 2012-02-09 11:50 -0500

csiph-web