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


Groups > comp.lang.python > #11935

Re: Replacement for the shelve module?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'plenty': 0.03; 'subject:module': 0.04; 'currency': 0.07; '21,': 0.09; 'cents': 0.09; 'am,': 0.12; 'binary': 0.13; 'do!': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.16; 'purposes,': 0.18; 'trying': 0.21; 'header:In- Reply-To:1': 0.22; '(or': 0.23; 'gregory': 0.23; 'somehow': 0.23; 'though.': 0.23; 'aug': 0.24; "i'm": 0.27; 'seeing': 0.28; 'problem': 0.28; 'message-id:@mail.gmail.com': 0.29; "won't": 0.29; 'fairly': 0.30; 'confident': 0.30; 'ewing': 0.30; 'sun,': 0.30; 'subject:?': 0.31; "isn't": 0.33; 'it.': 0.33; 'probably': 0.33; 'to:addr:python-list': 0.33; 'quite': 0.34; 'round': 0.34; 'visible': 0.34; 'weird': 0.34; 'certain': 0.35; 'but': 0.37; 'something': 0.37; 'two': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; "there's": 0.39; 'to:addr:python.org': 0.39; "it's": 0.40; 'your': 0.61; 'results': 0.61; 'home,': 0.63; '*does*': 0.84; 'manages': 0.84; 'often.': 0.84; 'subject:Replacement': 0.84; 'cent': 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 :content-type; bh=6yq3CoGz5lR3ZeaNUHhETvuojTLAmfi13JNxOsfgQQ8=; b=lYQrPrUxR3IyC/FYuzhir3sfEQFDw07t+A5iBhSmx01RcSpIX/Zu6o3C9yJ5ibgyPv VMCOv0YiS7BFC1vWXyu69RVmwxancCdO3MKvfcHboT57o9cngYUkDNiKobr5lRIVxBMQ R7SOWMssdpsHVsaD3AUPpidyCMaCuESQllVZI=
MIME-Version 1.0
In-Reply-To <9bb2ahFgjbU1@mid.individual.net>
References <1e35ff5e-785e-41db-a50f-976e6ef60692@h9g2000vbr.googlegroups.com> <4e4ec962$0$29986$c3e8da3$5496439d@news.astraweb.com> <mailman.247.1313792673.27778.python-list@python.org> <4e4f1004$0$29966$c3e8da3$5496439d@news.astraweb.com> <9bb2ahFgjbU1@mid.individual.net>
Date Sun, 21 Aug 2011 01:54:29 +0100
Subject Re: Replacement for the shelve module?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.274.1313888073.27778.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1313888073 news.xs4all.nl 23888 [2001:888:2000:d::a6]:47392
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:11935

Show key headers only | View raw


On Sun, Aug 21, 2011 at 1:37 AM, Gregory Ewing
<greg.ewing@canterbury.ac.nz> wrote:
> There's a certain accounting package I work with that *does*
> use floats -- binary ones -- for accounting purposes, and
> somehow manages to get away with it. Not something I would
> recommend trying at home, though.
>

Probably quite a few, actually. It's not a very visible problem so
long as you always have plenty of "spare precision", and you round
everything off to two decimals (or however many for your currency).
Eventually you'll start seeing weird results that are a cent off, but
you won't notice them often. And hey. You store $1.23 as 1.23, and it
just works! It must be the right thing to do!

Me, I store dollars-and-cents currency in cents. Always. But that's
because I never need fractional cents. I'm not sure what the best way
to handle fractional cents is, but I'm fairly confident that this
isn't it:

http://thedailywtf.com/Articles/Price-in-Nonsense.aspx

ChrisA

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


Thread

Replacement for the shelve module? Forafo San <ppv.grps@gmail.com> - 2011-08-19 08:31 -0700
  Re: Replacement for the shelve module? Ken Watford <kwatford@gmail.com> - 2011-08-19 11:49 -0400
  Re: Replacement for the shelve module? Thomas Jollans <t@jollybox.de> - 2011-08-19 17:54 +0200
    Re: Replacement for the shelve module? Forafo San <ppv.grps@gmail.com> - 2011-08-19 09:21 -0700
  Re: Replacement for the shelve module? Miki Tebeka <miki.tebeka@gmail.com> - 2011-08-19 10:15 -0700
  Re: Replacement for the shelve module? Robert Kern <robert.kern@gmail.com> - 2011-08-19 12:45 -0500
  Re: Replacement for the shelve module? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-20 06:36 +1000
    Re: Replacement for the shelve module? Robert Kern <robert.kern@gmail.com> - 2011-08-19 17:24 -0500
      Re: Replacement for the shelve module? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-20 11:38 +1000
        Re: Replacement for the shelve module? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-08-21 12:37 +1200
          Re: Replacement for the shelve module? Chris Angelico <rosuav@gmail.com> - 2011-08-21 01:54 +0100

csiph-web