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


Groups > comp.lang.python > #77576

Re: Storing instances using jsonpickle

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'mrab': 0.05; 'duplicate': 0.07; 'plenty': 0.07; 'dan': 0.09; 'iterate': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'dict': 0.16; 'dictionary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'tuple.': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'thu,': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'skip:g 30': 0.30; 'message- id:@mail.gmail.com': 0.30; 'int,': 0.31; 'safely': 0.31; 'sep': 0.31; 'this.': 0.32; 'fri,': 0.33; 'skip:d 20': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'easily': 0.37; 'pm,': 0.38; 'bad': 0.39; 'use.': 0.39; 'direct': 0.67; "'foo'": 0.84; 'calm': 0.84; 'dict()': 0.84; 'float,': 0.84; 'yes!': 0.91; '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=qHtD9i4QKCSIlYpC274CWLOdUKsdHx6rvPFhza4HOHA=; b=A+2jb1jsOkXkarc2+tmdRwOt6SWxEJ+3v0G9lxPwiQtRX/T0j8IegACapjM23XRzb1 rKjvaKfWzbwUHD3udUez9U1ia/nPgCe4mXI1rFUFW4YTR6p0RFOgdg5ei7uT6S+bbAet wHdDXwDOVh3k+gJIFWAKaPJXN8nIF40rOVuf5zGMM5ZQlxY5ZT/ZPmTJ1JVlAr00RoQT u90KaXPWNabd1cDy7LW0UdOs9hildTWvzerc9GuaNiVgOlcaKIG6g+/trpMmCz33me+b oZ9biJZ0Z66tg0j90U1Bt7FMR7I9bu/VkAkJoPY5KPP7RHeTirrO14CZj0PMfUfPxEVr c+5Q==
MIME-Version 1.0
X-Received by 10.42.118.211 with SMTP id y19mr11436015icq.12.1409893689484; Thu, 04 Sep 2014 22:08:09 -0700 (PDT)
In-Reply-To <lubenp$gpg$1@dont-email.me>
References <c54f7a2f-cf2c-4ee9-ba8e-a309761c1c6a@googlegroups.com> <mailman.13748.1409777587.18130.python-list@python.org> <46e782a5-b087-4f95-aadb-26e233bf5419@googlegroups.com> <5407A69B.3030707@mrabarnett.plus.com> <mailman.13761.1409807846.18130.python-list@python.org> <lubenp$gpg$1@dont-email.me>
Date Fri, 5 Sep 2014 15:08:09 +1000
Subject Re: Storing instances using jsonpickle
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.13783.1409893692.18130.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409893692 news.xs4all.nl 2940 [2001:888:2000:d::a6]:58644
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77576

Show key headers only | View raw


On Fri, Sep 5, 2014 at 2:38 PM, Dan Sommers <dan@tombstonezero.net> wrote:
> On Thu, 04 Sep 2014 15:17:17 +1000, Chris Angelico wrote:
>
>> On Thu, Sep 4, 2014 at 9:39 AM, MRAB <python@mrabarnett.plus.com> wrote:
>
>>> The key of a dict could also be int, float, or tuple.
>>
>> Yes! Yes! DEFINITELY do this!! Ahem. Calm down a little, it's not that
>> outlandish an idea...
>
> Using floats is a bad idea.  Consider this python code:
>
>     dictionary = dict()
>     original = get_some_floating_point_value()
>     dictionary[original] = 'foo'
>     string_version = str(original)  # this is where things head south
>     duplicate = float(string_version)
>     value = dictionary.get(duplicate)
>
> Okay, so what is value?  Is it 'foo'?  Is it None?
>
> (Yes, I can fix this.  If I *know* that original is a float, then I
> could use original.hex() instead of str(original).)

There are issues with direct lookups, yes, but you can safely and
easily iterate over that dictionary, and that's going to have plenty
of use.

ChrisA

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


Thread

Storing instances using jsonpickle Josh English <Joshua.R.English@gmail.com> - 2014-09-03 13:32 -0700
  Re: Storing instances using jsonpickle Ned Batchelder <ned@nedbatchelder.com> - 2014-09-03 16:52 -0400
    Re: Storing instances using jsonpickle Josh English <Joshua.R.English@gmail.com> - 2014-09-03 15:30 -0700
      Re: Storing instances using jsonpickle MRAB <python@mrabarnett.plus.com> - 2014-09-04 00:39 +0100
        Re: Storing instances using jsonpickle Denis McMahon <denismfmcmahon@gmail.com> - 2014-09-04 01:11 +0000
      Re: Storing instances using jsonpickle Ned Batchelder <ned@nedbatchelder.com> - 2014-09-03 22:18 -0400
        Re: Storing instances using jsonpickle Sam Raker <sam.raker@gmail.com> - 2014-09-03 21:52 -0700
        Re: Storing instances using jsonpickle Josh English <Joshua.R.English@gmail.com> - 2014-09-15 12:30 -0700
      Re: Storing instances using jsonpickle Chris Angelico <rosuav@gmail.com> - 2014-09-04 15:17 +1000
        Re: Storing instances using jsonpickle Dan Sommers <dan@tombstonezero.net> - 2014-09-05 04:38 +0000
          Re: Storing instances using jsonpickle Chris Angelico <rosuav@gmail.com> - 2014-09-05 15:08 +1000
      Re: Storing instances using jsonpickle MRAB <python@mrabarnett.plus.com> - 2014-09-04 12:07 +0100
      Re: Storing instances using jsonpickle MRAB <python@mrabarnett.plus.com> - 2014-09-05 18:04 +0100
        Re: Storing instances using jsonpickle Marko Rauhamaa <marko@pacujo.net> - 2014-09-05 20:16 +0300
          Re: Storing instances using jsonpickle Ned Batchelder <ned@nedbatchelder.com> - 2014-09-05 13:30 -0400
            Re: Storing instances using jsonpickle Marko Rauhamaa <marko@pacujo.net> - 2014-09-05 21:04 +0300
              Re: Storing instances using jsonpickle Ned Batchelder <ned@nedbatchelder.com> - 2014-09-05 16:50 -0400
                Re: Storing instances using jsonpickle Marko Rauhamaa <marko@pacujo.net> - 2014-09-05 23:57 +0300
          Re: Storing instances using jsonpickle Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2014-09-06 00:18 +0200
      Re: Storing instances using jsonpickle Chris Angelico <rosuav@gmail.com> - 2014-09-06 10:20 +1000
      Re: Storing instances using jsonpickle MRAB <python@mrabarnett.plus.com> - 2014-09-06 17:32 +0100
      Re: Storing instances using jsonpickle Ned Batchelder <ned@nedbatchelder.com> - 2014-09-06 12:56 -0400
      Re: Storing instances using jsonpickle Terry Reedy <tjreedy@udel.edu> - 2014-09-06 14:27 -0400

csiph-web