Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #33784
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| 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; 'subject:Python': 0.05; '%s"': 0.07; 'formatting': 0.07; '(1,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'terry': 0.09; 'cases': 0.15; '"%"': 0.16; '"%s': 0.16; 'blessing': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'relevance': 0.16; 'syntax.': 0.16; 'wrote:': 0.17; 'jan': 0.18; '>>>': 0.18; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'forgot': 0.27; 'header:X-Complaints-To:1': 0.28; 'strings,': 0.29; '"the': 0.29; 'to:addr:python-list': 0.33; 'pm,': 0.35; 'received:org': 0.36; 'really': 0.36; 'skip:{ 10': 0.36; 'should': 0.36; 'two': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'easy': 0.60; 'decided': 0.65; 'special': 0.73; 'received:fios.verizon.net': 0.84; 'obvious,': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: Yet another Python textbook |
| Date | Wed, 21 Nov 2012 23:04:26 -0500 |
| References | <CAB89DN0nusHZU32zP5UbTSUH8P7aXJomssBT-Jge7LEhaOtphg@mail.gmail.com> <CALwzid=3b_Gv3XR5iYvo7Pc0ZjXERB60daT9AjVoOG1OAP9vNg@mail.gmail.com> <CAB89DN0M5NzpoLRtcXRtM4Vs4xrOfw0wZq64GkU-DKy=Ei8HJQ@mail.gmail.com> <mailman.34.1353398989.29569.python-list@python.org> <31a82817-8c9b-4dd2-a468-89d8d081fd1b@googlegroups.com> <mailman.96.1353445247.29569.python-list@python.org> <50AD0962.5080002@ncf.ca> <CAPTjJmr55ZjpF9RBog39QZyTRixh=tTJH-5_pu3YTL4hWmfCAg@mail.gmail.com> <CAN1F8qXksLhbwb-DsvpcMdQDTkwWp1u92F7yObS7=TncvT9xwQ@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 |
| In-Reply-To | <CAN1F8qXksLhbwb-DsvpcMdQDTkwWp1u92F7yObS7=TncvT9xwQ@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.191.1353557089.29569.python-list@python.org> (permalink) |
| Lines | 34 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1353557089 news.xs4all.nl 6909 [2001:888:2000:d::a6]:47471 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:33784 |
Show key headers only | View raw
On 11/21/2012 6:21 PM, Joshua Landau wrote:
> Since we've decided to derail the conversation...
>
> "{}".format() is a blessing an "" % () should go. "%" has no relevance
> to strings, is hard to "get" and has an appalling* syntax. Having two
> syntaxes just makes things less obvious, and the right choice rarer.
>
> str.format is also really easy. I don't understand what makes you disagree.
>
> Easy vs easier:
>
> >>> "%s %s %s" % (1, 2, 3)
> '1 2 3'
>
> >>> "{} {} {}".format(1, 2, 3)
> '1 2 3'
You forgot the cases where % formatting has to be special cased.
>>> "The answer is {}.".format(1)
'The answer is 1.'
>>> "The answer is {}.".format((1,))
'The answer is (1,).'
>>> "The answer is %s" % 1
'The answer is 1'
>>> "The anwser is %s" % (1,)
'The answer is 1'
>>> "The answer is %s" % ((1,),)
'The answer is (1,)'
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: Yet another Python textbook Chris Angelico <rosuav@gmail.com> - 2012-11-20 19:09 +1100
Re: Yet another Python textbook wxjmfauth@gmail.com - 2012-11-20 06:57 -0800
Re: Yet another Python textbook Chris Angelico <rosuav@gmail.com> - 2012-11-21 08:00 +1100
Re: Yet another Python textbook wxjmfauth@gmail.com - 2012-11-21 06:49 -0800
Re: Yet another Python textbook wxjmfauth@gmail.com - 2012-11-21 06:49 -0800
Re: Yet another Python textbook "Colin J. Williams" <cjw@ncf.ca> - 2012-11-21 12:03 -0500
Re: Yet another Python textbook Chris Angelico <rosuav@gmail.com> - 2012-11-22 09:17 +1100
Re: Yet another Python textbook "Colin J. Williams" <cjw@ncf.ca> - 2012-11-22 07:24 -0500
Re: Yet another Python textbook Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-22 11:27 -0700
Re: Yet another Python textbook "Colin J. Williams" <cjw@ncf.ca> - 2012-11-22 17:41 -0500
Re: Yet another Python textbook Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-23 03:26 +0000
Re: Yet another Python textbook Terry Reedy <tjreedy@udel.edu> - 2012-11-22 17:12 -0500
Re: Yet another Python textbook Dave Angel <d@davea.name> - 2012-11-21 17:58 -0500
Re: Yet another Python textbook Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-21 16:11 -0700
Re: Yet another Python textbook Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-21 23:26 +0000
Re: Yet another Python textbook Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-21 23:32 +0000
Re: Yet another Python textbook Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-21 17:19 -0700
Re: Yet another Python textbook Terry Reedy <tjreedy@udel.edu> - 2012-11-21 23:04 -0500
Re: Yet another Python textbook Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-11-20 21:55 +0000
Re: Yet another Python textbook Chris Angelico <rosuav@gmail.com> - 2012-11-21 09:25 +1100
csiph-web