Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45680
| Path | csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'operator': 0.03; 'cpython': 0.05; 'python3': 0.07; 'subject:PEP': 0.07; 'pep': 0.09; 'python': 0.11; '3.1.3': 0.16; 'does,': 0.16; 'received:65.55.116.7': 0.16; 'skip:> 20': 0.16; 'specifier': 0.16; 'str.format()': 0.16; 'looked': 0.18; '>>>': 0.22; 'to:name :python-list@python.org': 0.22; 'instead.': 0.24; 'received:65.55.116': 0.24; 'question': 0.24; "i've": 0.25; 'source': 0.25; 'skip:" 20': 0.27; 'skip:_ 20': 0.27; '2010,': 0.27; 'header:In-Reply-To:1': 0.27; 'skip:p 30': 0.29; "i'm": 0.30; 'code': 0.31; 'implemented': 0.33; 'date:': 0.34; "i'd": 0.34; 'but': 0.35; "didn't": 0.36; 'so,': 0.37; 'email addr:python.org': 0.37; 'thank': 0.38; 'nov': 0.38; 'to:addr :python-list': 0.38; 'skip:_ 30': 0.39; 'subject:': 0.39; 'to:addr:python.org': 0.39; 'email addr:gmail.com': 0.63; 're:': 0.63; 'such': 0.63; 'skip:n 10': 0.64; 'more': 0.64; 'email name :python-list': 0.65; 'as:': 0.81; '-0300': 0.84; '2013': 0.98 |
| X-TMN | [2u4UuO340IPfT/EXFa1oa2ncHQowiRSq] |
| 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 | Tue, 21 May 2013 21:49:28 +0300 |
| Importance | Normal |
| In-Reply-To | <CADUW+M=Y7b=4ZEENVzx4p6YpVD8T0eG=qz7sz8+iEow-5-o+jQ@mail.gmail.com> |
| References | <CADUW+M=Y7b=4ZEENVzx4p6YpVD8T0eG=qz7sz8+iEow-5-o+jQ@mail.gmail.com> |
| Content-Type | text/plain; charset="iso-8859-1" |
| Content-Transfer-Encoding | quoted-printable |
| MIME-Version | 1.0 |
| X-OriginalArrivalTime | 21 May 2013 18:49:28.0013 (UTC) FILETIME=[EBE327D0:01CE5653] |
| 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.1929.1369162176.3114.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369162176 news.xs4all.nl 15890 [2001:888:2000:d::a6]:34928 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45680 |
Show key headers only | View raw
________________________________
> From: alyssonbruno@gmail.com
> Date: Tue, 21 May 2013 09:03:13 -0300
> Subject: Re: PEP 378: Format Specifier for Thousands Separator
> To: python-list@python.org
>
> This work in 3.1+:
>
> $ python3
> Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> one_number = 1234567
> >>> print('number={:,}'.format(one_number))
> number=1,234,567
> >>>
>
Thank you, but let me rephrase it. I'm already using str.format() but I'd like to use '%' (BINARY_MODULO) operator instead.
I've looked into the source code of CPython 2.7.5 and I've found no evidence of the thousands separator been implemented on formatint() in "Objects/unicodeobject.c".
I also didn't find the _PyString_FormatLong() used in formatlong(). Where is _PyString_FormatLong() located?
So, the question is: Where would I change the CPython 2.7.5 source code to enable '%' (BINARY_MODULO) to format using the thousands separator like str.format() does, such as:
>>>sys.stderr.write('%,d\n' % 1234567)
1,234,567
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-21 21:49 +0300
Re: PEP 378: Format Specifier for Thousands Separator 88888 Dihedral <dihedral88888@gmail.com> - 2013-05-23 19:29 -0700
RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 18:25 +0300
Re: PEP 378: Format Specifier for Thousands Separator Andreas Perstinger <andipersti@gmail.com> - 2013-05-24 19:28 +0200
RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-25 00:07 +0300
csiph-web