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


Groups > comp.lang.python > #67209

Re: extend methods of decimal module

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'repository': 0.05; 'binary': 0.07; 'string': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rounds': 0.09; 'subject:module': 0.09; 'python': 0.11; 'argument.': 0.16; 'decimal.': 0.16; 'mark,': 0.16; 'message-id:@post.gmane.org': 0.16; 'name),': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'script,': 0.16; 'str()': 0.16; 'then?': 0.16; 'thursday,': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'header:User- Agent:1': 0.23; 'guys': 0.24; 'values': 0.27; 'header:X -Complaints-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'quickly': 0.29; 'url:code': 0.29; "i'm": 0.30; '(which': 0.31; 'code': 0.31; 'decimal': 0.31; 'received:132': 0.31; 'writes:': 0.31; 'class': 0.32; 'another': 0.32; 'agree': 0.35; 'but': 0.35; 'there': 0.35; 'returning': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'throughout': 0.37; 'wrong': 0.37; 'on-line': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'simply': 0.61; 'first': 0.61; "you've": 0.63; 'strategy': 0.64; 'url:p': 0.64; 'series': 0.66; 'realized': 0.68; 'capital': 0.73; 'viewed': 0.74; 'hey,': 0.75; 'all!': 0.84; 'float,': 0.84; 'convinced': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
Subject Re: extend methods of decimal module
Date Fri, 28 Feb 2014 08:54:12 +0000 (UTC)
References <02cdd9c7-aef7-4cc7-a813-cd1c9627ceb4@googlegroups.com> <mailman.7160.1392836388.18130.python-list@python.org> <94b1962a-0004-4c5b-b484-972a166b88b5@googlegroups.com> <CAKJDb-NaZmLysq+2KWgd_f4UPKCk7jdLZkvcCM6ECL5TSAwCRQ@mail.gmail.com> <mailman.7165.1392847869.18130.python-list@python.org> <55525f2c-fd3a-4927-b642-2dbf5eae7e9b@googlegroups.com> <mailman.7422.1393512211.18130.python-list@python.org> <360e87d2-4daf-4222-8ebe-51f3e4d1fade@googlegroups.com> <mailman.7429.1393518292.18130.python-list@python.org> <9f7b535f-9e5d-45df-96f6-6cd8f6b4a524@googlegroups.com> <mailman.7448.1393545085.18130.python-list@python.org> <63868b32-5206-435d-aa3d-f3040f65f72b@googlegroups.com> <mailman.7452.1393561622.18130.python-list@python.org> <aa444b5e-5814-45ec-9d55-612c30e0a1d7@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host sea.gmane.org
User-Agent Loom/3.14 (http://gmane.org/)
X-Loom-IP 132.230.1.31 (Mozilla/5.0 (Windows NT 6.1; rv:27.0) Gecko/20100101 Firefox/27.0)
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.7462.1393577681.18130.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393577681 news.xs4all.nl 2895 [2001:888:2000:d::a6]:35421
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67209

Show key headers only | View raw


Mark H. Harris <harrismh777 <at> gmail.com> writes:

> 
> On Thursday, February 27, 2014 10:26:59 PM UTC-6, Chris Angelico wrote:
> 
> > Create Decimal values from strings, not from the str() of a float,
> > which first rounds in binary and then rounds in decimal.
> > 
> 
> Thanks Chris...  another excellent point... ok, you guys have about
convinced me (which is spooky) but,
> hey, I'm teachable...   what is the best strategy then?
> 
> If you get a chance, take a look at the  dmath.py  code on:
> 
>    https://code.google.com/p/pythondecimallibrary/ 
> 
> I got the repository working correctly for me, and the files can be viewed
on-line ...   its a long script, but
> not that hard to look through because all the functions pretty much work
the same... when you've seen one
> converging series function in python you've seen them all!
> 
> Thanks again, Chris.
> 

Hi Mark,
I quickly skimmed through your code and I don't think there is a need for
your D() function at all. I thought it was a class adding some extra
functionality to Decimal (that's because you used a capital letter for its
name), but now I realized that it's just a function returning a Decimal from
the string representation of its argument.
Since by now, I guess, we all agree that using the string representation is
the wrong approach, you can simply use Decimal instead of D() throughout
your code.
Best,
Wolfgang


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


Thread

extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-19 07:30 -0800
  Re: extend methods of decimal module Terry Reedy <tjreedy@udel.edu> - 2014-02-19 13:59 -0500
    Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-19 13:30 -0800
      Re: extend methods of decimal module Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-02-19 15:54 -0600
      Re: extend methods of decimal module Terry Reedy <tjreedy@udel.edu> - 2014-02-19 17:10 -0500
        Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 04:07 -0800
          Re: extend methods of decimal module Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-27 14:42 +0000
            Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 07:42 -0800
              Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-02-28 02:57 +1100
              Re: extend methods of decimal module Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-27 16:24 +0000
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 15:00 -0800
                Re: extend methods of decimal module Wolfgang <xpysol@gmail.com> - 2014-02-27 15:43 -0800
                Re: extend methods of decimal module Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-27 23:50 +0000
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 18:15 -0800
                Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-02-28 15:26 +1100
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 21:18 -0800
                Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-02-28 16:26 +1100
                Re: extend methods of decimal module Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-02-28 08:54 +0000
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 10:23 -0800
                Re: extend methods of decimal module Steven D'Aprano <steve@pearwood.info> - 2014-02-28 03:15 +0000
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 20:41 -0800
                Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-02-28 16:00 +1100
                Re: extend methods of decimal module Steven D'Aprano <steve@pearwood.info> - 2014-02-28 07:34 +0000
                Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-02-28 19:52 +1100
                Re: extend methods of decimal module Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-02-28 15:11 +0000
                Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-03-01 02:36 +1100
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 10:34 -0800
                Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-03-01 05:37 +1100
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 11:26 -0800
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 11:39 -0800
                Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-28 12:17 -0800
          Re: extend methods of decimal module Terry Reedy <tjreedy@udel.edu> - 2014-02-27 12:07 -0500
            Re: extend methods of decimal module Anssi Saari <as@sci.fi> - 2014-03-01 08:55 +0200
              Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-03-01 16:49 -0800
          Re: extend methods of decimal module Chris Angelico <rosuav@gmail.com> - 2014-02-28 04:48 +1100
      Re: extend methods of decimal module Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-02-19 16:27 -0600
      Re: extend methods of decimal module casevh@gmail.com - 2014-02-19 21:11 -0800
        Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 02:33 -0800
          Re: extend methods of decimal module casevh@gmail.com - 2014-02-28 06:23 -0800
  Re: extend methods of decimal module Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2014-02-19 22:29 +0000
    Re: extend methods of decimal module "Mark H. Harris" <harrismh777@gmail.com> - 2014-02-27 02:37 -0800

csiph-web