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


Groups > comp.lang.python > #45765

RE: PEP 378: Format Specifier for Thousands Separator

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <carlosnepomuceno@outlook.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'subject:PEP': 0.07; '#define': 0.09; '-looking': 0.09; 'happen?': 0.09; 'implements': 0.09; 'pep': 0.09; 'analysing': 0.16; 'called.': 0.16; 'literals': 0.16; 'means.': 0.16; 'received:65.55.116.7': 0.16; 'specifier': 0.16; 'str.format()': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'written': 0.21; 'to:name:python-list@python.org': 0.22; 'received:65.55.116': 0.24; 'header': 0.24; 'source': 0.25; 'mention': 0.26; 'skip:_ 20': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; 'patch': 0.29; '???': 0.30; 'code': 0.31; 'date:': 0.34; 'maybe': 0.34; 'skip:d 20': 0.34; "can't": 0.35; 'definition': 0.35; 'but': 0.35; 'really': 0.36; '+0100': 0.36; "i'll": 0.36; 'error.': 0.37; 'so,': 0.37; 'turn': 0.37; 'email addr:python.org': 0.37; 'to:addr:python-list': 0.38; 'skip:_ 30': 0.39; 'explain': 0.39; 'subject:': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'even': 0.60; 'email addr:gmail.com': 0.63; 're:': 0.63; 'happen': 0.63; 'email name :python-list': 0.65; 'compiles': 0.84; 'optimisation': 0.84; 'oscar': 0.84; 'carlos': 0.91; 'relating': 0.93; '2013': 0.98
X-TMN [67HEYDH4WnvVAIlYN/+z6ve+rBukVIAK]
X-Originating-Email [carlosnepomuceno@outlook.com]
From Carlos Nepomuceno <carlosnepomuceno@outlook.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: PEP 378: Format Specifier for Thousands Separator
Date Thu, 23 May 2013 03:44:36 +0300
Importance Normal
In-Reply-To <CAHVvXxRN3znY4M5XDp=UObZ+Q9o9ZrrzA5pZbiz0fFR_7Zrqsw@mail.gmail.com>
References <BLU176-W10190CB892A0414C988A05D7A80@phx.gbl> <BLU176-W9FF52BDCE42DAF40E6AC7D7A80@phx.gbl> <knghok$3bd$1@ger.gmane.org> <519c348a$0$6599$c3e8da3$5496439d@news.astraweb.com> <mailman.1958.1369219519.3114.python-list@python.org> <mailman.1972.1369249307.3114.python-list@python.org> <CAHVvXxRN3znY4M5XDp=UObZ+Q9o9ZrrzA5pZbiz0fFR_7Zrqsw@mail.gmail.com>
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-OriginalArrivalTime 23 May 2013 00:44:36.0889 (UTC) FILETIME=[B3615890:01CE574E]
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 <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.1986.1369269883.3114.python-list@python.org> (permalink)
Lines 60
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369269883 news.xs4all.nl 15909 [2001:888:2000:d::a6]:47686
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45765

Show key headers only | View raw


----------------------------------------
> From: oscar.j.benjamin@gmail.com
> Date: Thu, 23 May 2013 01:30:53 +0100
> Subject: Re: PEP 378: Format Specifier for Thousands Separator
> To: carlosnepomuceno@outlook.com
> CC: pruebauno@latinmail.com; python-list@python.org
>
> On 22 May 2013 23:31, Carlos Nepomuceno <carlosnepomuceno@outlook.com> wrote:
>>
>> I still don't understand why % benefits from literals optimization ("'%d'%12345") while '{:d}'.format(12345) doesn't.
>
> There's no reason why that optimisation can't happen in principle.
> However no one has written a patch for it. Why don't you look into
> what it would take to make it happen?
>
>
> Oscar

Maybe I'll look into that later, but I couldn't even find how the hell they made _Py_InsertThousandsGrouping() been called.

That's what I got when analysing % formating:

Thousands separator format specifier for str.__mod__()
======================================================

@Objects/stringobject.c: implements formatint() for '%' processing
-Looking for code used in str.format()

@Objects/stringlib/formatter.h: implements str.format()
-It uses STRINGLIB_GROUPING() to do the job.

@Objects/stringlib/stringdefs.h: #define STRINGLIB_GROUPING       _PyString_InsertThousandsGrouping
@Objects/stringlib/unicodedefs.h: #define STRINGLIB_GROUPING       _PyUnicode_InsertThousandsGrouping
@Objects/stringobject.c: #define _Py_InsertThousandsGrouping _PyString_InsertThousandsGrouping
@Objects/stringobject.h: declares _PyString_InsertThousandsGrouping()
@???: ??? _PyString_InsertThousandsGrouping ??? _Py_InsertThousandsGrouping
@Objects/stringlib/localeutil.h: implements _Py_InsertThousandsGrouping()


Let me explain what that means. I found no relating declarations/definitions that turn _PyString_InsertThousandsGrouping into _Py_InsertThousandsGrouping.

So, I don't even know how that source code compiles without error.

:/ really strange...


Not to mention the lots of code inside header definition files! Weird!!!! 		 	   		  

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


Thread

Re: PEP 378: Format Specifier for Thousands Separator Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-21 14:53 -0500
  Re: PEP 378: Format Specifier for Thousands Separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-22 02:59 +0000
    Re: PEP 378: Format Specifier for Thousands Separator Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-21 22:38 -0500
    Re: PEP 378: Format Specifier for Thousands Separator Skip Montanaro <skip@pobox.com> - 2013-05-22 05:45 -0500
      Re: PEP 378: Format Specifier for Thousands Separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-22 14:58 +0000
        Re: PEP 378: Format Specifier for Thousands Separator Ned Batchelder <ned@nedbatchelder.com> - 2013-05-22 14:30 -0400
          Re: PEP 378: Format Specifier for Thousands Separator nn <pruebauno@latinmail.com> - 2013-05-22 13:26 -0700
            RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-23 01:31 +0300
              Re: PEP 378: Format Specifier for Thousands Separator nn <pruebauno@latinmail.com> - 2013-05-23 06:44 -0700
                RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-23 18:26 +0300
                Re: PEP 378: Format Specifier for Thousands Separator Dave Angel <davea@davea.name> - 2013-05-23 14:42 -0400
                Re: PEP 378: Format Specifier for Thousands Separator nn <pruebauno@latinmail.com> - 2013-05-24 06:50 -0700
                Re: PEP 378: Format Specifier for Thousands Separator Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-23 16:19 -0400
                RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 01:20 +0300
                Re: PEP 378: Format Specifier for Thousands Separator Jerry Hill <malaclypse2@gmail.com> - 2013-05-23 21:17 -0400
                RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 04:41 +0300
            Re: PEP 378: Format Specifier for Thousands Separator Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-05-23 01:30 +0100
            RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-23 03:44 +0300

csiph-web