Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!feed.xsnews.nl!border-2.ams.xsnews.nl!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'method.': 0.05; 'compiler': 0.07; 'encouraging': 0.07; 'expressions': 0.07; 'subject:string': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; '"are': 0.16; 'expressions,': 0.16; 'from:addr:lanyjie': 0.16; 'from:name:yingjie lan': 0.16; 'hostile.': 0.16; 'partly': 0.16; 'personally,': 0.16; 'received:124.205': 0.16; 'received:98.138.89.199': 0.16; 'reply- to:addr:lanyjie': 0.16; 'reply-to:name:yingjie lan': 0.16; 'yingjie': 0.16; 'tend': 0.17; '(or': 0.18; 'url:02': 0.21; 'header:In-Reply-To:1': 0.22; 'variable': 0.23; 'towards': 0.24; 'cheers,': 0.26; 'cc:2**0': 0.26; 'cc:addr:python.org': 0.28; 'subject:skip:i 10': 0.28; 'reply-to:addr:yahoo.com': 0.28; "skip:' 10": 0.29; "can't": 0.32; 'like:': 0.32; 'probably': 0.32; 'could': 0.32; 'something': 0.34; 'url:org': 0.35; 'does': 0.36; 'calling': 0.36; 'easily': 0.36; 'but': 0.37; 'far': 0.37; 'subject:: ': 0.37; 'some': 0.39; 'quite': 0.40; 'more': 0.63; 'header:Reply-To:1': 0.67; 'url:2011': 0.72; 'conservative': 0.84; 'received:98.138.90.53': 0.91; 'enhancement': 0.93 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 762450.21029.bm@omp1057.mail.ne1.yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1333368010; bh=qiFl1yW8hH3if0X+8+fqun5JqYUC7hTlsUg55V8lgOw=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=qurhjfBN37L/WUva2jLFFIHu54p4sxwxwVzSdF5gUo2hLJI8y6tZaGxoDC7EgSfmUNhinte0yBIHpRLNkzzOwUwo4mteiRxD1HlZ5E4Qux1615GPq0P8e9l7rd/H2fVfGsScNiOTnzritKp29MwV211lp8WBbMukeeIpn2f6/98= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=k1HaJ9MGmb4cqsAKl/tYevBYOaTS/GujxOsHyntgzNRVrpipLfCVUo6Wyf98X0weVDrum6U+rkYxgnYdrZtI7+P7rWNwgRCpBdRzy6TmeTMFN3lZVtDQiPC594uNkRrHSO2Pr7CLaYBVoCAvBgbfEtED2YZKLEtcS3vbcQpvVsw=; X-YMail-OSG: .oSOZiEVM1n_Hecg1mqMckVmu4C8x1efmYVizWlF2fLz_nB Wv.ERFRYzNmvNRCMc6M8iBlPcoVxkP1QR13_qDqLj7qudjywznudwH5IrSf9 i9d_yoGHXcUm3YdCDjiHSQBx.g2QrQLBzQT34V3Jxqz.Lw1vyZaIqcJIGUE_ FihrWEEqp2fwFOt1VRm9clGq1pI34ijsqGih_6HgPD.7EZ_KvJ7yh83.ALtB jKg3ube54qtkwTDbWBOpacGTnsyU8fXM.7oJUnGJmKblohC2SXWIxFBru9Op FV7p68V9Pm_rys2aRKNV1aEo_dycWhtQxp6Y.zqvposhM9zlOlJQmuFNacvl 2u7smllL4AcB3aIK0rcB_ZI0Y8eR5yeqKeh9fL2gVSkyted7JCaC52l5b.yI imYmL7UA1OAYZgFVhJ7pWxtHna_IdFnPYX.JzlFhr7Wi8Kq7n59DSQzmUWQD C3gt._ryFIuYnSOSzrceqWOlpe6H.IL..dLu5egg9czklJtBS6Lely72x2K5 c0x5x2tsuW95aqYBH9R_r0XaNmfTE4L3r70O.W3uW4SC8CpcqfPMSrj25h5E pQW4e6s7aIuvXXNbYcjY2xodEqYsbmoRXqTbh1ek3RRYhAwyT7breuZO9.Gz Bm4GR8o35CxAh_gU2E3fO X-Mailer: YahooMailWebService/0.8.117.340979 References: <1333174946.18436.YahooMailNeo@web121506.mail.ne1.yahoo.com> <4f7962b0$0$29981$c3e8da3$5496439d@news.astraweb.com> <1333357906.6147.YahooMailNeo@web121503.mail.ne1.yahoo.com> Date: Mon, 2 Apr 2012 05:00:10 -0700 (PDT) From: Yingjie Lan Subject: Re: string interpolation for python To: Chris Rebert In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Yingjie Lan 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1333368019 news.xs4all.nl 6874 [2001:888:2000:d::a6]:36143 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22461 > "Are you %(name)s" % locals() # or vars()=0A=0A=0A=0AThis partly solves t= he problem, however, you=A0=0Acan't work with expressions inside, like:=0A= =0A> d"sin($x$) =3D $sin(x)$"=0A=0A=0AAlso, what if locals() or vars() does= not contain=0Athe variable "x"? (x could be nonlocal or global).=0A=0A=0A>= It's more conservative than hostile. Here's some insight:=0A> http://www.b= oredomandlaziness.org/2011/02/status-quo-wins-stalemate.html=0A>=0A=0AYou a= re probably right...Harmless enhancement is still probable?=0A=0A=0A>=A0=0A= > Personally, in isolation, the only part of your proposal I find=0A> /trul= y/ objectionable is the support for arbitrary expressions, since=0A> it wou= ld tend towards encouraging suboptimal factoring. But we also=0A=0AI don't = quite see that as a problem. The compiler (or translator, as you=A0=0Amenti= oned earlier) could easily make=A0d"sin($x$) =3D $sin(x)$" into=0Asomething= like: ''.join(["sin(", str(x), ") =3D ", str(sin(x))]=0Awhich would far mo= re efficient than calling the format() method.=0A=0ACheers,=0AYingjie