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


Groups > comp.lang.python > #67233

Re: extend methods of decimal module

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.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.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'resulting': 0.04; 'startup': 0.05; 'encouraging': 0.07; 'explicit': 0.07; 'float': 0.07; 'nicely': 0.07; 'odd': 0.07; 'expense': 0.09; 'learn,': 0.09; 'pep': 0.09; 'subject:module': 0.09; 'type,': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; ':-p': 0.16; '<>?': 0.16; 'champion': 0.16; 'decimals?': 0.16; 'deferred': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'it),': 0.16; 'literal,': 0.16; 'literals': 0.16; 'non-built-in': 0.16; 'vulgar': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'fraction': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'words': 0.29; 'said,': 0.30; 'message- id:@mail.gmail.com': 0.30; 'too.': 0.31; "d'aprano": 0.31; 'decimal': 0.31; 'default,': 0.31; 'reduced': 0.31; 'steven': 0.31; 'types.': 0.31; 'becomes': 0.33; 'maybe': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'ordered': 0.36; 'should': 0.36; 'two': 0.37; 'performance': 0.37; 'being': 0.38; 'massive': 0.38; 'expect': 0.39; 'does': 0.39; 'though,': 0.39; 'use.': 0.39; 'either': 0.39; 'most': 0.60; 'tell': 0.60; 'affect': 0.61; 'till': 0.61; 'first': 0.61; 'more': 0.64; 'mar': 0.68; 'real-world': 0.68; 'default': 0.69; 'integrated': 0.69; '"just': 0.84; 'around,': 0.84; 'characters,': 0.84; 'complex,': 0.84; 'cost,': 0.84; 'duplication': 0.84; 'float,': 0.84; 'obvious.': 0.84; 'on?': 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=e3V3ou2hu62VEXMraT+IiCJRuswsWkk8Khxb8wa1vs8=; b=cTtUBIMuUPf1nZ05/Zs0ygYs0AbLmYxKWntvO2QL4sd42H0H2Y/ZZAdXXItOGiXNH5 fMEm/kw6ZVNOdS5kLu8+NSOkjudQ9QQpCDzZfaSqfvQulYviqMzscNU8mp3mcv+4uDbS e4+Eaaejum+bXv5QQK4XxgCFw1netUxBIoAsQ7gcPshHrQmPDntZSwX1mWu7Tkct1hBl 5NxSXCVosnBhdHUkV4TqVIO2ug6lPfN0G2dIVcRv5Ym2EmXvvHVcOL4qZl+cOyK7cRpE DqMqb50jKUc6qrKnQCCSdvbogcl+C6TINvYTx0L5EYslnbO71ZbWJT13FNtARJ2jhieN apBA==
MIME-Version 1.0
X-Received by 10.68.98.3 with SMTP id ee3mr4245191pbb.31.1393601767255; Fri, 28 Feb 2014 07:36:07 -0800 (PST)
In-Reply-To <5310a735$0$29985$c3e8da3$5496439d@news.astraweb.com>
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> <530fff58$0$11113$c3e8da3@news.astraweb.com> <f5305bab-c526-420c-8590-d73ff318ee9c@googlegroups.com> <mailman.7454.1393563614.18130.python-list@python.org> <53103c03$0$11113$c3e8da3@news.astraweb.com> <mailman.7461.1393577568.18130.python-list@python.org> <5310a735$0$29985$c3e8da3$5496439d@news.astraweb.com>
Date Sat, 1 Mar 2014 02:36:07 +1100
Subject Re: extend methods of decimal module
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.7476.1393601775.18130.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393601775 news.xs4all.nl 2929 [2001:888:2000:d::a6]:55749
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67233

Show key headers only | View raw


On Sat, Mar 1, 2014 at 2:11 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
>> or there needs to be a system for constructing literals
>> of non-built-in types. And if Decimal becomes built-in, then why that
>> and not <<insert type name here>>?
>
> 'Cos we have ten fingers and in count in decimal :-P

We talk in words and characters, so we have an inbuilt Unicode type.
We count in decimal using Arabic numerals, so we have an inbuilt
Decimal type. We also learn, in grade school, to manipulate vulgar
fractions, so should Fraction be inbuilt? And we use transcendental
numbers, too. And ordered mappings - most real-world interpretations
of "dictionary" include that it's sorted alphabetically. Not all of
them need to be inbuilt.

>> Also, if Decimal becomes a built-in type, does that affect the numeric
>> tower?
>
> I don't see why whether the type is built-in or not should affect its
> position in the numeric tower. (I would expect that by the time Python
> 4000 comes around, Decimal will be nicely integrated in the tower.)

Well, it's more important if it's the default (and asking for an
explicit float if you want it), but it would still be a bit odd for
just one of the built-in numeric types to not have a place in an
otherwise-tidy tower. But definitely, if it's the default, we have to
ask: what about complex numbers? Are they now two Decimals? Can we get
complex floats? And does all this mean there's a massive duplication
going on? What happens if you sum() a Decimal, a float, a Decimal
complex, and a float complex? What's the resulting type? All these
questions would have to be answered.

That said, though, I would support the addition of a Decimal literal,
and start encouraging its use. Python startup performance is a cost,
but maybe the cost of Decimal could be either reduced or deferred till
first use, so that's not so obvious. Being able to tell people "Just
type 0.1d and it'll be more accurate at the expense of being slower"
would be a significant gain.

But someone else can champion that PEP :)

ChrisA

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