Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22476

Re: string interpolation for python

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <lanyjie@yahoo.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'only,': 0.07; 'subject:string': 0.09; 'subject:python': 0.11; '>>>': 0.14; 'to:name:python-list@python.org': 0.14; 'denotes': 0.16; 'expression,': 0.16; 'expression.': 0.16; 'forbid': 0.16; 'from:addr:lanyjie': 0.16; 'from:name:yingjie lan': 0.16; 'nesting': 0.16; 'received:124.205': 0.16; 'reply- to:addr:lanyjie': 0.16; 'reply-to:name:yingjie lan': 0.16; 'yingjie': 0.16; '(the': 0.16; 'string': 0.19; 'example': 0.19; 'header:In-Reply-To:1': 0.22; 'that.': 0.24; "haven't": 0.24; 'cheers,': 0.26; 'preceding': 0.28; 'subject:skip:i 10': 0.28; 'reply-to:addr:yahoo.com': 0.28; "i'm": 0.29; 'embedded': 0.30; 'really': 0.33; 'something': 0.34; 'to:addr:python-list': 0.35; 'done': 0.35; 'things': 0.35; 'should': 0.35; 'there': 0.36; 'dynamic': 0.37; 'subject:: ': 0.37; 'to:addr:python.org': 0.39; 'where': 0.39; 'issue': 0.40; 'skip:$ 10': 0.62; 'first': 0.62; 'offer': 0.63; 'final': 0.64; 'header:Reply-To:1': 0.67; 'is\xa0': 0.84; 'peter,': 0.84; 'received:98.138.90.53': 0.91
X-Yahoo-Newman-Property ymail-3
X-Yahoo-Newman-Id 685475.34498.bm@omp1026.mail.ne1.yahoo.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1333382542; bh=SoDSC6ilBrE4xyy+3Yr3uBEeHjK9+W2xGtwPGA85P0c=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=6g+ikZhWydU1QagIX3O/5EprswBPv4V89qSr0b90iOeKp54eoHWlBUA9MSKLYzcLsj+35bxB4TSidZ8UYmmXpB9GkH9+3nHPeCvIKWG4mpP4+UHjOpQVuzEX0xxhdw1sqnaAj3XMBBv8iDVY6fHMl9XyiAlBr+GCeYanUcXwwwQ=
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:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=fvohaVbrnxDyF9g011tVBVVlY9ZPVjHyeSg47KnWon5mQS3nG/UDe3Jc0PiyzbHiST4uItETd0miuWu8Uo6/6H0NUTPOB6wEryfM7/hx8Px1x745732eMOg3qWu8YSjfA4Mb1rs3PZ/j3wGN+eOd0jCWyceT0QvLe8l0tCY6J7w=;
X-YMail-OSG X8RuTIkVM1kiYwvuteJDk3.OmLe31QC7YqrraPNM9GjSuXt lw_MG0eXW805SY215wdvA7HmA7ycv7IKPFsLK2tte1LsaUknAG4ArsCWTol_ 5EiGsqgR8tK8fIQA9g1V3wRxljN2f9QUc5BZyvzDzzuAccPpXyaoOofJgTuC 0.of4UGIDIheln5h3rZGGPocPEtso_dJkJTiCwLqWZ5D_zdzgHrXjmFRM2me _.xex9AKKMZxLJOvq1CeKn.cneUVcWDtc3FdmT9WsiQXFH.SAuAoRl1yTkXE 7stgxZYLF._tSk_WdTkkY5lWT.21qMGZYfZiCu1sHH8DnC.KADzHv0BlvTwb So4AcukmXvvbJ4VUeo_ma8ynO6guo.eshiCocl5g0X8oHNr9IrdQsI1sWb5. _JwUCWWuYNtduXpPRFbp9zNKoH4onvTa.eLtxf5LIKDlEfNucPzXBWJ202LT n3D.4xPQHwXfGbSO9S08z0Vc-
X-Mailer YahooMailWebService/0.8.117.340979
References <CABgq=FyhR+Ldujj3YKRBpVXRVoeoayuXZviUUcNx-gXnFiHLSw@mail.gmail.com> <CACoeR0xV=28j6rFHm1ep3gzH9C0sbDqyxRRwX-JrVm3G+rrXww@mail.gmail.com> <1333174946.18436.YahooMailNeo@web121506.mail.ne1.yahoo.com> <jl6ma0$ptg$1@dough.gmane.org> <mailman.1200.1333352587.3037.python-list@python.org> <4f7962b0$0$29981$c3e8da3$5496439d@news.astraweb.com> <mailman.1205.1333358032.3037.python-list@python.org> <4f79938c$0$29981$c3e8da3$5496439d@news.astraweb.com> <mailman.1212.1333370596.3037.python-list@python.org> <jlce45$o7a$1@dont-email.me> <jlcgth$bnf$1@dont-email.me>
Date Mon, 2 Apr 2012 09:02:22 -0700 (PDT)
From Yingjie Lan <lanyjie@yahoo.com>
Subject Re: string interpolation for python
To "python-list@python.org" <python-list@python.org>
In-Reply-To <jlcgth$bnf$1@dont-email.me>
MIME-Version 1.0
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To Yingjie Lan <lanyjie@yahoo.com>
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.1223.1333382551.3037.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1333382551 news.xs4all.nl 6913 [2001:888:2000:d::a6]:44003
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22476

Show key headers only | View raw


>>   In that case you should re-think the delimiters, so that you have

>>   something
>>  that can be nested.  An example (example only, I'm not in love with it 
> as
>>  a final form):

Haven't really thought about that. Nesting is a big 
issue if in the embedded expression, there is another 
dynamic string expression. For example (the first
'%' immediately preceding the first quote denotes
the start of a dynamic string expression)::

>>> first_name, family_name = "Peter", "Johns"
>>> %"Hi $ first_name+%", $family_name$" $!"

'Hi Peter, Johns!'

However, nesting is really cluttering things up and
we should forbid it without loosing power:
The above example can be done without nesting:
>>> >>> %"Hi $ first_name$, $family_name$!"
'Hi Peter, Johns!'

Can you offer an example where nesting is 
better or necessary?

Cheers,
Yingjie

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 00:39 -0700
  Re: string interpolation for python Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-04-02 11:01 +0300
  Re: string interpolation for python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-04-02 08:26 +0000
    Re: string interpolation for python Chris Angelico <rosuav@gmail.com> - 2012-04-02 18:47 +1000
    Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 02:11 -0700
      Re: string interpolation for python Duncan Booth <duncan.booth@invalid.invalid> - 2012-04-02 10:19 +0000
      Re: string interpolation for python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-04-02 11:54 +0000
        Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 05:40 -0700
          Re: string interpolation for python Laurent Claessens <moky.math@gmail.com> - 2012-04-02 15:02 +0200
            Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 07:25 -0700
            Re: Re: string interpolation for python Evan Driscoll <driscoll@cs.wisc.edu> - 2012-04-02 15:36 -0500
          Re: string interpolation for python mwilson@the-wire.com - 2012-04-02 10:46 -0400
            Re: string interpolation for python mwilson@the-wire.com - 2012-04-02 11:34 -0400
              Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 09:02 -0700
      Re: string interpolation for python rusi <rustompmody@gmail.com> - 2012-04-02 06:04 -0700
    Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 02:17 -0700
      Re: string interpolation for python alex23 <wuwei23@gmail.com> - 2012-04-02 22:47 -0700
    Re: string interpolation for python Chris Angelico <rosuav@gmail.com> - 2012-04-02 19:56 +1000
    Re: string interpolation for python Chris Rebert <clp2@rebertia.com> - 2012-04-02 03:23 -0700
    Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 04:46 -0700
    Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 05:00 -0700
    Re: string interpolation for python Chris Angelico <rosuav@gmail.com> - 2012-04-03 00:58 +1000
      Re: string interpolation for python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-04-02 18:56 +0000
    Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 08:49 -0700
    Re: string interpolation for python Chris Angelico <rosuav@gmail.com> - 2012-04-03 08:38 +1000
      Re: string interpolation for python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-04-02 23:18 +0000
    Re: string interpolation for python Yingjie Lan <lanyjie@yahoo.com> - 2012-04-02 18:57 -0700

csiph-web