Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '*not*': 0.07; 'binary': 0.07; 'subject:PEP': 0.07; 'string': 0.09; 'arguments': 0.09; 'formatting': 0.09; 'function,': 0.09; 'guys!': 0.09; 'pretend': 0.09; 'argument,': 0.16; 'formatted': 0.16; 'itself,': 0.16; 'operation.': 0.16; 'operator.': 0.16; 'received:65.55.116.7': 0.16; 'specifier': 0.16; 'str.format()': 0.16; 'tuple': 0.16; 'tuple.': 0.16; 'hack': 0.22; 'to:name:python-list@python.org': 0.22; 'print': 0.22; 'received:65.55.116': 0.24; 'skip:% 10': 0.24; 'header:In-Reply-To:1': 0.27; 'skip:- 40': 0.29; '[1]': 0.29; 'tuples': 0.31; 'another': 0.32; 'url:python': 0.33; 'problem': 0.35; 'thanks': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.37; 'represent': 0.38; 'url:library': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'first': 0.61; 'making': 0.63; 'love': 0.65; 'email name:python-list': 0.65; 'design.': 0.68; 'honest': 0.78; 'hate': 0.91 X-TMN: [O+TH/YwEEcCds12qhwCqxo6X5jPxZc48] X-Originating-Email: [carlosnepomuceno@outlook.com] From: Carlos Nepomuceno To: "python-list@python.org" Subject: RE: PEP 378: Format Specifier for Thousands Separator Date: Fri, 24 May 2013 01:20:26 +0300 Importance: Normal In-Reply-To: References: , ,,, , , , , , , , , , , , , ,,, ,,<519c348a$0$6599$c3e8da3$5496439d@news.astraweb.com>, ,,<519C3D99.5040107@gmail.com>, ,,, ,,<519cdcff$0$6599$c3e8da3$5496439d@news.astraweb.com>, ,,, , , <87eaaf24-df6a-4f6b-b873-16ca96c12e24@b2g2000yqe.googlegroups.com>, , , , , , <519E6327.8070204@davea.name>, Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 23 May 2013 22:20:26.0662 (UTC) FILETIME=[B9DB3460:01CE5803] 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: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369347695 news.xs4all.nl 15905 [2001:888:2000:d::a6]:41050 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45848 ----------------------------------------=0A= > To: python-list@python.org=0A= > From: tjreedy@udel.edu=0A= [...]=0A= >> It's a conflict in the design. A tuple is used to supply multiple=0A= >> arguments to the % operator. So if you want to have a tuple as the=0A= >> first argument=2C you need to enclose it in another tuple.=0A= >=0A= > The problem is that interpolating 1 to many items into a string is *not*= =0A= > a binary operation. The needed hack to pretend that it is=2C using a tupl= e=0A= > to represent multiple items rather than just itself=2C was one of the=0A= > reasons for making string formatting a honest function=2C where multiple= =0A= > items to be formatted are passed as multiple arguments.=0A= =0A= Thanks so much guys! Now I understand why some people hate %-formatting!=0A= =0A= I don't think that's a problem because there's no format specifier for tupl= es in the %-formatting definition[1].=0A= So it's up to the user to make the necessary conversion.=0A= =0A= I still love the %-formatting style!=0A= =0A= Can str.format() do the following?=0A= =0A= f =3D '%d %d %d'=0A= v =3D '1=2C2=2C3'=0A= print f % eval(v)=0A= =0A= If yes=2C how?=0A= =0A= =0A= [1] http://docs.python.org/2/library/stdtypes.html#string-formatting = =