Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'formatting': 0.07; 'method,': 0.07; 'brace': 0.09; 'compact': 0.09; 'cc:addr:python-list': 0.10; 'language,': 0.11; 'boost.': 0.16; 'curly': 0.16; 'reason.': 0.16; 'substituted': 0.16; 'twenty': 0.16; 'string': 0.17; 'wrote:': 0.17; 'exists': 0.17; 'translate': 0.20; 'parameters': 0.20; 'libraries': 0.22; 'cc:2**0': 0.23; "python's": 0.23; 'somewhere': 0.24; 'cc:no real name:2**0': 0.24; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'implemented': 0.27; 'realize': 0.27; 'c++': 0.27; 'chris': 0.28; "i'm": 0.29; 'function': 0.30; 'languages': 0.33; 'another': 0.33; 'version': 0.34; 'exist': 0.35; 'said,': 0.35; 'pm,': 0.35; 'but': 0.36; 'rather': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'sure': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'more': 0.63; 'our': 0.65; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'expressive': 0.84; 'glad': 0.86; 'hand,': 0.97 Date: Wed, 21 Nov 2012 17:58:37 -0500 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1 MIME-Version: 1.0 To: Chris Angelico Subject: Re: Yet another Python textbook References: <31a82817-8c9b-4dd2-a468-89d8d081fd1b@googlegroups.com> <50AD0962.5080002@ncf.ca> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:Pnblzyraabi6gKDzSjT2FiFrrUA+gPBeZrwHI46pC2z Q1FRbVdBeGTvfBIdm7DwI6xxt/wKN7bphpIkmoOwc3WRUYJiMy 1DAvYc5vrVXHJW0gnlg6r65as2Yc6EF0os823pd9E/mKWH0Qub B0TeCA6IpqLHnwtXTuSScrvGxnfGBCG2ijwDm3uttg2ojVeg8K kf/TCYCsookamDIHMae3gvZf57v0+siDQZq9OsLUWmaJ/6yru+ ygDNFclBmCLGkuKUjy8tccTrhpIZNp7vgx7elAA9Z3fPCr1SFs M+UTTaBKRRQ04I6BqaEkbzF5ix3RMb7MZLv7gYIbkLN4ZvU4A= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: d@davea.name 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1353538743 news.xs4all.nl 6981 [2001:888:2000:d::a6]:58117 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:33776 On 11/21/2012 05:17 PM, Chris Angelico wrote: > > > > That said, though, I'm just glad that %-formatting is staying. It's an > extremely expressive string formatting method, and exists in many > languages (thanks to C's heritage). Pike's version is insanely > powerful, Python's is more like C's, but all three are compact and > convenient. > > str.format(), on the other hand, is flexible. It strikes me as rather > more complicated than a string formatting function needs to be, but > that may be a cost of its flexibility. > > Some don't realize that one very powerful use for the .format style of working is that it makes localization much more straightforward. With the curly brace approach, one can translate the format string into another language, and if the parameters have to be substituted in another order, it's all in one place. Twenty years ago, I implemented such a thing for our product (C++), for just that reason. I'm sure that by now, the libraries exist somewhere in the C++ stdlibs, or at least in Boost. -- DaveA