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: 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 To: "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: References: , , 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 ________________________________=0A= > From: alyssonbruno@gmail.com =0A= > Date: Tue=2C 21 May 2013 09:03:13 -0300 =0A= > Subject: Re: PEP 378: Format Specifier for Thousands Separator =0A= > To: python-list@python.org =0A= > =0A= > This work in 3.1+: =0A= > =0A= > $ python3 =0A= > Python 3.1.3 (r313:86834=2C Nov 28 2010=2C 11:28:10) =0A= > [GCC 4.4.5] on linux2 =0A= > Type "help"=2C "copyright"=2C "credits" or "license" for more information= . =0A= > >>> one_number =3D 1234567 =0A= > >>> print('number=3D{:=2C}'.format(one_number)) =0A= > number=3D1=2C234=2C567 =0A= > >>> =0A= > =0A= =0A= Thank you=2C but let me rephrase it. I'm already using str.format() but I'd= like to use '%' (BINARY_MODULO) operator instead.=0A= =0A= I've looked into the source code of CPython 2.7.5 and I've found no evidenc= e of the thousands separator been implemented on formatint() in "Objects/un= icodeobject.c".=0A= =0A= I also didn't find the _PyString_FormatLong() used in formatlong(). Where i= s _PyString_FormatLong() located?=0A= =0A= So=2C the question is: Where would I change the CPython 2.7.5 source code t= o enable '%' (BINARY_MODULO) to format using the thousands separator like s= tr.format() does=2C such as:=0A= =0A= >>>sys.stderr.write('%=2Cd\n' % 1234567)=0A= 1=2C234=2C567 =