Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7989
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!weretis.net!feeder1.news.weretis.net!news1.tnib.de!feed.news.tnib.de!news.tnib.de!news.belwue.de!news-zh.switch.ch!kanaga.switch.ch!switch.ch!newsfeed-00.mathworks.com!panix!roy |
|---|---|
| From | Roy Smith <roy@panix.com> |
| Newsgroups | comp.lang.python |
| Subject | Re: What is this syntax ? |
| Date | Sun, 19 Jun 2011 16:20:48 -0400 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 35 |
| Message-ID | <roy-DD0C35.16204819062011@news.panix.com> (permalink) |
| References | <4dfdfc99$0$715$426a34cc@news.free.fr> <4dfe10d1$0$28053$426a34cc@news.free.fr> <roy-2A6DC8.11394419062011@news.panix.com> <e724fc3e-8198-4fb7-b1d3-96834f3fa6bb@34g2000pru.googlegroups.com> |
| NNTP-Posting-Host | localhost |
| X-Trace | reader1.panix.com 1308514849 26712 127.0.0.1 (19 Jun 2011 20:20:49 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Sun, 19 Jun 2011 20:20:49 +0000 (UTC) |
| User-Agent | MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7989 |
Show key headers only | View raw
In article
<e724fc3e-8198-4fb7-b1d3-96834f3fa6bb@34g2000pru.googlegroups.com>,
rusi <rustompmody@gmail.com> wrote:
> On Jun 19, 8:39 pm, Roy Smith <r...@panix.com> wrote:
>
> > This is one of the (very) few places PHP wins over Python. In PHP, I
> > would write this as
> >
> > print "'$x'"
>
>
> You dont find
>
> >>> print '"%s"' % x
>
> readable? Why?
I didn't say it wasn't readable, I said other things were easier to
read. 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)
because I don't have to line up the nth format specifier with the nth
data item.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What is this syntax ? candide <candide@free.invalid> - 2011-06-19 15:41 +0200
Re: What is this syntax ? Laurent Claessens <moky.math@gmail.com> - 2011-06-19 15:50 +0200
Re: What is this syntax ? Noah Hall <enalicho@gmail.com> - 2011-06-19 14:58 +0100
Re: What is this syntax ? Chris Angelico <rosuav@gmail.com> - 2011-06-20 00:03 +1000
Re: What is this syntax ? candide <candide@free.invalid> - 2011-06-19 17:08 +0200
Re: What is this syntax ? Roy Smith <roy@panix.com> - 2011-06-19 11:39 -0400
Re: What is this syntax ? rusi <rustompmody@gmail.com> - 2011-06-19 09:58 -0700
Re: What is this syntax ? Roy Smith <roy@panix.com> - 2011-06-19 16:20 -0400
Re: What is this syntax ? Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it> - 2011-06-19 23:06 +0200
Re: What is this syntax ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-19 23:19 +0000
Re: What is this syntax ? Vito 'ZeD' De Tullio <zak.mc.kraken@libero.it> - 2011-06-20 07:42 +0200
Re: What is this syntax ? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-19 15:29 -0700
csiph-web