Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18445

Re: .format vs. %

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jeanpierreda@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'bug.': 0.07; 'python': 0.08; '3.0,': 0.09; 'deprecated': 0.09; 'dict': 0.09; '~ethan~': 0.09; 'am,': 0.12; 'stored': 0.13; '8:26': 0.16; 'formatting.': 0.16; 'outcome:': 0.16; 'pydev': 0.16; 'subject:vs.': 0.16; 'way"': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'jan': 0.19; 'cc:no real name:2**0': 0.20; 'maybe': 0.21; 'discussion': 0.22; 'wrote': 0.22; 'header:In-Reply-To:1': 0.22; 'dictionary': 0.23; 'formatting': 0.23; 'pep': 0.23; 'way?': 0.23; 'string': 0.24; 'cc:2**0': 0.24; 'object,': 0.24; '(in': 0.26; "i'm": 0.26; 'url:mailman': 0.28; 'message-id:@mail.gmail.com': 0.28; 'pass': 0.29; 'cc:addr:python.org': 0.29; 'fewer': 0.30; 'kelly': 0.30; 'shift': 0.30; '2009.': 0.31; 'values': 0.32; 'tue,': 0.32; 'url:listinfo': 0.32; 'there': 0.33; 'received:209.85.160': 0.33; 'eric': 0.34; 'too': 0.34; '(not': 0.35; 'notes': 0.35; 'received:209.85.160.46': 0.35; 'received:mail- pw0-f46.google.com': 0.35; 'supposed': 0.35; 'unless': 0.35; 'url:python': 0.36; '(from': 0.37; 'thread': 0.37; 'url:pipermail': 0.37; 'variables': 0.37; 'two': 0.37; 'reference': 0.37; 'received:google.com': 0.37; 'think': 0.37; 'plans': 0.37; 'received:209.85': 0.38; 'easier': 0.38; 'url:org': 0.39; 'why': 0.39; "it's": 0.40; 'received:209': 0.40; 'according': 0.61; '2012': 0.67; '"there': 0.84; '3101': 0.84; 'many.': 0.84; 'zen': 0.84; '"one': 0.91
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:content-transfer-encoding; bh=96AW3yaju2J0oynO0tSrWTdLBnhlFV7xlWBgbPq9TaQ=; b=PuHtCXEscSNYNa+fvvWopogrZ9YXlZdcYKXGPd9M8jpw4OZAJ+Tms+mBTCazGzN00Z UZtAxlymAGaprWk9qW/e1xe7NM3/C7L+JxC1WVVwhwG4m+NbP2oWaNkkmkJU00p2Y7fb l/5Lrj9owXgqkRM3FLgVx97oSTVlfrNFWQzKY=
MIME-Version 1.0
In-Reply-To <4F030221.3050902@stoneleaf.us>
References <5642862.375.1325355574622.JavaMail.geo-discussion-forums@vbbhx10> <4EFF559E.1050408@gmail.com> <mailman.4321.1325544682.27778.python-list@python.org> <fd8933b8-0cca-4127-8f9b-38b056ee075a@h12g2000yqg.googlegroups.com> <4f027b79$0$29880$c3e8da3$5496439d@news.astraweb.com> <mailman.4334.1325570337.27778.python-list@python.org> <4f029d1e$0$29880$c3e8da3$5496439d@news.astraweb.com> <CALwzidmJW5Cp-V06w9mb2BG1TtSbKXf9yCQBzAb=-KubYRm+9Q@mail.gmail.com> <4F030221.3050902@stoneleaf.us>
From Devin Jeanpierre <jeanpierreda@gmail.com>
Date Tue, 3 Jan 2012 15:02:47 -0500
Subject Re: .format vs. %
To Ethan Furman <ethan@stoneleaf.us>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
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 <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.4378.1325621011.27778.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325621011 news.xs4all.nl 6984 [2001:888:2000:d::a6]:33786
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18445

Show key headers only | View raw


> "one obvious way" != "only one way"

Which way is the obvious way? Why is it obvious?

For me, sprintf-formatting is "obviously" easier to use (less typing)
unless you're pulling values from a dictionary or object, or already
have all the variables stored in a dict you can pass in with **d.

-- Devin

On Tue, Jan 3, 2012 at 8:26 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
> Ian Kelly wrote:
>>
>> 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.
>
>
> Eric Smith wrote (from a thread on pydev in 02-2011):
>> The last thread on this I have a reference to was in September 2009. I
>> think was basically the outcome:
>> http://mail.python.org/pipermail/python-dev/2009-September/092399.html
>>
>> So there will be no deprecation, just a gradual shift to PEP 3101
>> formatting.
>
>
> Ian Kelly wrote:
>>
>> 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).
>
>
> Agreed that this is a documentation bug.
>
>
> Ian Kelly wrote:
>>
>> 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.
>
>
> "one obvious way" != "only one way"
>
> ~Ethan~
> --
> http://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

.format vs. % davidfx <dgeorge29ca@gmail.com> - 2011-12-31 10:19 -0800
  Re: .format vs. % Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-31 12:34 -0600
  Re: .format vs. % Yaşar Arabacı <yasar11732@gmail.com> - 2011-12-31 20:34 +0200
    Re: .format vs. % davidfx <dgeorge29ca@gmail.com> - 2011-12-31 10:44 -0800
    Re: .format vs. % davidfx <dgeorge29ca@gmail.com> - 2011-12-31 10:44 -0800
      Re: .format vs. % Yaşar Arabacı <yasar11732@gmail.com> - 2011-12-31 20:51 +0200
      Re: .format vs. % Evan Driscoll <edriscoll@wisc.edu> - 2011-12-31 13:47 -0500
        Re: .format vs. % Miki Tebeka <miki.tebeka@gmail.com> - 2012-01-01 13:11 -0800
          Re: .format vs. % Terry Reedy <tjreedy@udel.edu> - 2012-01-02 05:29 -0500
        Re: .format vs. % Miki Tebeka <miki.tebeka@gmail.com> - 2012-01-01 13:11 -0800
      Re: .format vs. % Alexander Kapps <alex.kapps@web.de> - 2011-12-31 19:59 +0100
      Re: .format vs. % Tim Chase <python.list@tim.thechases.com> - 2011-12-31 13:24 -0600
      Re: .format vs. % Lie Ryan <lie.1296@gmail.com> - 2012-01-01 06:34 +1100
      Re: .format vs. % Robert Kern <robert.kern@gmail.com> - 2011-12-31 19:43 +0000
      Re: .format vs. % Terry Reedy <tjreedy@udel.edu> - 2011-12-31 16:09 -0500
  Re: .format vs. % Ethan Furman <ethan@stoneleaf.us> - 2012-01-02 14:00 -0800
    Re: .format vs. % Rick Johnson <rantingrickjohnson@gmail.com> - 2012-01-02 17:59 -0800
      Re: .format vs. % Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-03 03:52 +0000
        Re: .format vs. % Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-02 22:58 -0700
          Re: .format vs. % Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-03 06:15 +0000
            Re: .format vs. % Ian Kelly <ian.g.kelly@gmail.com> - 2012-01-03 01:16 -0700
            Re: .format vs. % Ethan Furman <ethan@stoneleaf.us> - 2012-01-03 05:26 -0800
            Re: .format vs. % Ethan Furman <ethan@stoneleaf.us> - 2012-01-03 11:38 -0800
            Re: .format vs. % Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-01-03 15:02 -0500
            Re: .format vs. % Ethan Furman <ethan@stoneleaf.us> - 2012-01-03 12:16 -0800
        Re: .format vs. % Andrew Berg <bahamutzero8825@gmail.com> - 2012-01-03 04:55 -0600
        Re: .format vs. % Stefan Krah <stefan-usenet@bytereef.org> - 2012-01-03 12:47 +0100
          Re: .format vs. % Neil Cerutti <neilc@norwich.edu> - 2012-01-03 13:58 +0000
            Re: .format vs. % Stefan Krah <stefan-usenet@bytereef.org> - 2012-01-03 15:17 +0100
              Re: .format vs. % Neil Cerutti <neilc@norwich.edu> - 2012-01-03 15:15 +0000
                Re: .format vs. % Neil Cerutti <neilc@norwich.edu> - 2012-01-03 15:24 +0000
          Re: .format vs. % Neil Cerutti <neilc@norwich.edu> - 2012-01-03 19:46 +0000
            Re: .format vs. % Ethan Furman <ethan@stoneleaf.us> - 2012-01-03 12:00 -0800
            Re: .format vs. % Stefan Krah <stefan-usenet@bytereef.org> - 2012-01-03 21:53 +0100
        Re: .format vs. % Chris Angelico <rosuav@gmail.com> - 2012-01-04 00:04 +1100
  Re: .format vs. % Rick Johnson <rantingrickjohnson@gmail.com> - 2012-01-02 17:51 -0800
    Re: .format vs. % Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-01-03 03:47 +0000
  Re: .format vs. % 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-03 07:47 -0800
    Re: .format vs. % alex23 <wuwei23@gmail.com> - 2012-01-03 18:26 -0800
      Re: .format vs. % 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-04 00:25 -0800
        Re: .format vs. % alex23 <wuwei23@gmail.com> - 2012-01-04 16:23 -0800
          Re: .format vs. % 88888 Dihedral <dihedral88888@googlemail.com> - 2012-01-04 17:41 -0800

csiph-web