Path: csiph.com!usenet.pasdenom.info!news.albasani.net!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.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'rejected': 0.07; 'python': 0.09; '>>>>': 0.09; 'subject:string': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; 'cc:name:python list': 0.16; 'formatting.': 0.16; 'yingjie': 0.16; 'previously': 0.18; 'string': 0.19; 'wrote:': 0.19; 'all,': 0.21; 'header:In-Reply- To:1': 0.22; "i'd": 0.23; 'variable': 0.23; 'message- id:@mail.gmail.com': 0.24; 'idea': 0.24; 'cheers,': 0.26; 'received:209.85.212.46': 0.26; 'cc:2**0': 0.26; 'values': 0.28; 'cc:addr:python.org': 0.28; 'subject:skip:i 10': 0.28; 'code:': 0.28; 'hi,': 0.29; 'fri,': 0.30; 'chris': 0.31; 'feature': 0.31; 'url:python': 0.32; 'received:209.85.212': 0.32; 'received:209.85': 0.32; 'received:google.com': 0.32; 'really': 0.33; 'pm,': 0.34; 'add': 0.34; 'received:209': 0.35; 'url:library': 0.35; 'url:org': 0.35; 'another': 0.36; 'being': 0.36; 'subject:: ': 0.37; 'url:docs': 0.37; 'skip:f 20': 0.38; 'some': 0.39; 'too': 0.39; 'header:Received:5': 0.40; 'share': 0.61; '30,': 0.62; '2012': 0.62; 'different': 0.62; 'grab': 0.69; 'to:addr:yahoo.com': 0.82; 'sender:addr:chris': 0.84; 'url:rebertia': 0.84; 'url:string': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=OreFy5FOof9S80JU0V7iewjponfB/WbkkfMAE7ZsZeM=; b=QKJI/KK9k/u87O3fgm3HiLcIeWJmKlTq/cZYIQ3P0nLwD/tdOQilK4UvMpZYrsSZ3Z M1KH5MsH69SS6N6pjZyanCY1qLHIzosi+5I1oSOZztOQZGWN9eldNDpKiP/G1QnFGB6u zL6dwH71aHwVKF2NxdxOro/FySeRTyU1xwif0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=OreFy5FOof9S80JU0V7iewjponfB/WbkkfMAE7ZsZeM=; b=mZ05hbhN7YST16+UvH37RAKzNBD/vu+5bYQvtMYnlFWs1t/jTGx3523WUi7Tu2YacP oq+dWDH9qRwpFu7YxL+zpy6lQzZXXQfALCl5SzuALoXx6pe09udo737iPBJ4p1WS+UyA 4eQQ/nXIIbfbYjhZg4LjlMoRM1Qu2WHFosP+SfVumFLap28R5SDYeaKaZ5sygQ0VJpjE DgkNipStL+LI/cULpZP3YvGPaV5NGnnNomrKKhS3pUhgSMM9CVipM/UizzyhqkA7ZrV4 eDgoipDoLf+W1izCMRDeO47LvmiVuQxh5tO5yzD8KlnmN9WviSQFVOTXGk2NzVr/AVCV Lyxw== MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <1333174946.18436.YahooMailNeo@web121506.mail.ne1.yahoo.com> References: <1333174946.18436.YahooMailNeo@web121506.mail.ne1.yahoo.com> Date: Sat, 31 Mar 2012 00:51:50 -0700 X-Google-Sender-Auth: yC0REV4AAtIqy7ePxMB395tOGRs Subject: Re: string interpolation for python From: Chris Rebert To: Yingjie Lan Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQkXQjyQeu3MmiIUp/r546ixohytT1tHIevNX5p0K68Q4GnJLbSNl8damBjDTSGO6rt1AbUc Cc: python list X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1333180312 news.xs4all.nl 6919 [2001:888:2000:d::a6]:41234 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22412 On Fri, Mar 30, 2012 at 11:22 PM, Yingjie Lan wrote: > Hi all, > > I'd really like to share this idea of string interpolation for formatting. > Let's start with some code: > >>>> name = "Shrek" >>>> print( "Hi, $name$!") > Hi, Shrek! Python already has *3* different built-in string formatting/interpolation systems: http://docs.python.org/library/string.html#template-strings http://docs.python.org/library/string.html#format-string-syntax http://docs.python.org/library/stdtypes.html#string-formatting-operations Do we really want to add yet another to this pile? I would surmise that your key "implicitly grab variable values from the enclosing scope" feature has previously been rejected for being too magical. Cheers, Chris -- http://rebertia.com