Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(although': 0.05; 'library,': 0.05; 'happen,': 0.07; 'imply': 0.07; 'reason.': 0.07; 'python': 0.08; '3.0,': 0.09; 'commonly': 0.09; 'deprecated': 0.09; 'deprecated,': 0.09; 'dev': 0.09; 'obsolete': 0.09; "hasn't": 0.13; 'arbitrarily': 0.16; 'deprecate': 0.16; 'devs': 0.16; 'labeled': 0.16; 'name).': 0.16; 'removal.': 0.16; 'removed:': 0.16; 'subject:vs.': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'cc:addr:python-list': 0.16; 'mon,': 0.16; 'received:74.125.82.44': 0.16; 'received:mail-ww0-f44.google.com': 0.16; 'syntax': 0.16; 'wrote:': 0.18; 'yet.': 0.18; 'slightly': 0.19; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'cheers,': 0.20; 'maybe': 0.21; 'discussion': 0.22; '(or': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'statement': 0.23; 'formatting': 0.23; 'string': 0.24; 'cc:2**0': 0.24; 'code': 0.25; 'saying': 0.26; '(in': 0.26; "i'm": 0.26; 'function': 0.27; 'code,': 0.27; 'message-id:@mail.gmail.com': 0.28; 'print': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; '"real': 0.30; 'feature,': 0.30; 'fewer': 0.30; "didn't": 0.31; 'does': 0.32; 'point,': 0.32; "isn't": 0.33; "won't": 0.33; 'actually': 0.33; 'there': 0.33; 'agree': 0.33; 'done': 0.34; 'nobody': 0.34; 'view,': 0.34; 'too': 0.34; 'away.': 0.34; 'function.': 0.34; 'statement,': 0.34; '(not': 0.35; 'received:74.125.82': 0.35; 'notes': 0.35; 'supposed': 0.35; 'gotten': 0.37; 'two': 0.37; 'but': 0.37; 'received:74.125': 0.37; 'received:google.com': 0.37; 'plans': 0.37; 'could': 0.37; 'enough': 0.38; 'doing': 0.38; 'using': 0.38; 'steven': 0.38; 'some': 0.38; 'went': 0.38; 'should': 0.39; 'why': 0.39; "it's": 0.40; 'huge': 0.61; 'according': 0.61; 'happen': 0.61; 'free': 0.64; 'further': 0.64; 'cause': 0.67; '2012': 0.67; 'kept': 0.68; 'day': 0.69; 'become': 0.69; '"there': 0.84; 'being.': 0.84; 'many.': 0.84; 'zen': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=AiyIhCInBRVOTcqANOb//ilBaKLJv/R69vP8xXOAzF0=; b=rjMcXkg+oExhv+y2sk8V8yqkFp3R2ia+mBAqZk/uOMw9IiQROKJbWkteX2A63id2iL oAWCbxxuck3OW7fYHtLP8cYeWcvStDHcGWziiLcZ0YU2ScSsdxvZMB06n5R3+B4piIgZ 2usamuuh8WcT5mm7tNi6z9ORq1xYGKcpPDjFU= MIME-Version: 1.0 In-Reply-To: <4f029d1e$0$29880$c3e8da3$5496439d@news.astraweb.com> References: <5642862.375.1325355574622.JavaMail.geo-discussion-forums@vbbhx10> <4EFF559E.1050408@gmail.com> <4f027b79$0$29880$c3e8da3$5496439d@news.astraweb.com> <4f029d1e$0$29880$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Tue, 3 Jan 2012 01:16:13 -0700 Subject: Re: .format vs. % To: "Steven D'Aprano" Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list 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: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1325578606 news.xs4all.nl 6904 [2001:888:2000:d::a6]:54471 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18382 On Mon, Jan 2, 2012 at 11:15 PM, Steven D'Aprano wrote: > Which is exactly why it is not deprecated: it doesn't say it is > deprecated and has no timeline for removal. It may not even be removed: > "may" go away is not "will" go away. > > Going around saying that features are deprecated just because they may > (or may not) some day in the distant future become deprecated is FUD. It > simply isn't true that % formatting is deprecated: Python Dev has a > formal process for deprecating code, and that process has not been > applied to % and there are no plans to do so in the foreseeable future. So it's not formally deprecated, but it is nonetheless labeled obsolete and discouraged, or "informally deprecated" if you will. I'm not sure it's true that "there are no plans to do so in the foreseeable future." According to the release notes from Python 3.0, % formatting was supposed to be deprecated in Python 3.1. Why that didn't happen, I don't know. Maybe there was a discussion on py-dev where it was decided that % formatting would not be deprecated after all (in which case the misleading "obsolete" note really ought to be removed from the documentation). Maybe that discussion has been tabled for the time being. Or maybe it hasn't been deprecated simply because nobody has gotten around to actually doing it yet. In any case the statement of obsolescence and the lack of clarity about the feature's future is enough cause for me to avoid the feature, although you of course are free to use it however you want. > There is a huge code base using this feature, including the standard > library, and Python does not arbitrarily deprecate features used by real > code without good reason. Just because a number of Python devs want to > encourage people to use format doesn't imply that % will go away any time > before Python 4000. The reason for deprecating it is because Python currently has no fewer than three mechanisms for string formatting (not even including ordinary string concatenation), which according to the Zen of Python is two too many. In my view, % formatting has a lot in common with the print statement -- it's warty syntax that is better implemented as a function. In Python 3 we could have kept the print statement and avoided breaking a feature commonly used by "real code" by adding the print function as a supplement to the statement (probably with a slightly different name). But the devs went a step further and actually removed the print statement, and IMO that was a good thing. The same thing should be done with % formatting (although I agree on one point, it likely won't happen before Python 4). Cheers, Ian