Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8007
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <cpopa@bitdefender.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'host,': 0.09; 'imo.': 0.09; 'port,': 0.09; 'readable': 0.09; '>>>': 0.12; 'wrote:': 0.14; 'roy': 0.16; 'subject:syntax': 0.16; 'skip:" 40': 0.16; 'somewhere': 0.17; 'template': 0.19; 'seems': 0.21; "what's": 0.23; 'certainly': 0.25; 'string': 0.26; 'import': 0.29; 'opposed': 0.29; 'charset:iso-8859-15': 0.30; 'print': 0.31; 'to:addr:python-list': 0.33; "isn't": 0.33; 'php': 0.34; 'example,': 0.35; 'skip:" 10': 0.35; 'subject: ?': 0.35; 'subject:What': 0.35; 'quite': 0.36; 'similar': 0.37; 'something': 0.37; 'hello,': 0.38; 'subject:: ': 0.38; 'url:google': 0.38; 'easier': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'received:(helo localhost)': 0.73; 'subject:this': 0.76; 'received:ro': 0.93; 'url:80': 0.95 |
| Date | Mon, 20 Jun 2011 10:18:45 +0300 |
| From | Claudiu Popa <cpopa@bitdefender.com> |
| X-Priority | 3 (Normal) |
| To | python-list@python.org |
| Subject | Re: What is this syntax ? |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-15 |
| Content-Transfer-Encoding | quoted-printable |
| X-BitDefender-Spam | No (0) |
| X-BitDefender-SpamStamp | v1, build 2.8.97.162796, SQMD Hits: InvalidIPBytes34 97.192.25.0, rbl score: 0(0), bayes score: 500(0), pbayes score: 500(0), neunet score: 0(0), flags: [NN_LEGIT_BITDEFENDER; NN_LEGIT_MAILING_LIST_TO], SQMD: 902184dc8ec383e7f373c4c01ff8f8bb.fuzzy.fzrbl.org, total: 0(775) |
| X-BitDefender-Scanner | Clean, Agent: BitDefender qmail 3.1.0 on elfie.dsd.hq, sigver: 7.37967 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| 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.178.1308554725.1164.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1308554725 news.xs4all.nl 49180 [::ffff:82.94.164.166]:53235 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8007 |
Show key headers only | View raw
Hello,
Isn't this similar to php interpolation? And quite readable imo.
>>> import string
>>> template = string.Template("$scheme://$host:$port/$route#$fragment")
>>> template.substitute(scheme="http", host="google.com", port="80", route="", fragment="")
'http://google.com:80/#'
>>>
Roy Smith wrote:
> There's something nice about building up strings in-line, as
> opposed to having to look somewhere to see what's being interpolated.
> To give a more complex example, consider:
>
> print "$scheme://$host:$port/$route#$fragment"
>
> That certainly seems easier to me to read than:
>
> print "%s://%s:%s/%s#%s" % (scheme,
> port,
> host,
> route,
> fragment)
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: What is this syntax ? Claudiu Popa <cpopa@bitdefender.com> - 2011-06-20 10:18 +0300
Re: What is this syntax ? Ben Finney <ben+python@benfinney.id.au> - 2011-06-21 08:19 +1000
Re: new string-formatting preferred? (was "What is this syntax ?") Tim Chase <python.list@tim.thechases.com> - 2011-06-20 19:46 -0500
Re: new string-formatting preferred? (was "What is this syntax ?") Terry Reedy <tjreedy@udel.edu> - 2011-06-20 22:17 -0400
Re: new string-formatting preferred? (was "What is this syntax ?") Tim Chase <python.list@tim.thechases.com> - 2011-06-21 06:33 -0500
Re: new string-formatting preferred? (was "What is this syntax ?") Terry Reedy <tjreedy@udel.edu> - 2011-06-21 18:19 -0400
Re: new string-formatting preferred? (was "What is this syntax ?") Tim Chase <python.list@tim.thechases.com> - 2011-06-21 18:02 -0500
csiph-web