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


Groups > comp.lang.python > #33780

Re: Yet another Python textbook

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'syntax': 0.03; 'subject:Python': 0.05; 'say,': 0.05; '21,': 0.07; 'c++,': 0.07; 'level,': 0.07; 'skip:% 20': 0.07; 'way:': 0.09; '"%"': 0.16; 'blessing': 0.16; 'lisp': 0.16; 'relevance': 0.16; 'syntax.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'mostly': 0.20; 'sort': 0.21; 'trying': 0.21; 'import': 0.21; 'java': 0.21; 'example': 0.23; '15,': 0.23; 'flexibility': 0.23; 'header:In- Reply-To:1': 0.25; 'mix': 0.27; 'message-id:@mail.gmail.com': 0.27; 'strings,': 0.29; 'up.': 0.31; 'system,': 0.32; 'skip:s 30': 0.33; 'to:addr:python-list': 0.33; 'skip:d 20': 0.34; "can't": 0.34; 'received:google.com': 0.34; 'nov': 0.35; 'pm,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; '12,': 0.36; 'depends': 0.36; 'others.': 0.36; 'should': 0.36; 'two': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'easy': 0.60; 'most': 0.61; 'more': 0.63; 'natural': 0.65; 'manages': 0.84; 'to:name:python': 0.84; 'unholy': 0.84; 'obvious,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Q5Am7GcqcIF7vxUvVu1/NGX2moRe007dPab6H2VYwYo=; b=w3/xqKRajI0/cQrTTCWOq5Fy2mVNuk9YXS0XOHLhIsIAF1aDvljtxWuDNsl3b8NgH/ 7wu2hH4kKxlmbqmvmQPTREPcDMMiQ08Rsg/ytrzSRTfP4czxdec+/oMzzQUfWK4SvuMF /3JevfaHOlQYkGAbeehl/FeyRNyGJKatCJrM3IppCmBYqzULYilsSVgK9bit2YgNCDzE /NZBjnDLRk/TVGRhMO7BMBmrMV6tWtDb+7ufaVsnNZ+P/nuxKLN6LNNd88HFELXxk9yV gSoBZ/EDm2dvs99UyvYepWBbe2MP8eTB12pEIL4gdJemejSIjQQusbpXbMwXeOKebWpZ VTcw==
MIME-Version 1.0
In-Reply-To <CAN1F8qXksLhbwb-DsvpcMdQDTkwWp1u92F7yObS7=TncvT9xwQ@mail.gmail.com>
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>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 21 Nov 2012 17:19:18 -0700
Subject Re: Yet another Python textbook
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.185.1353543590.29569.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1353543590 news.xs4all.nl 6954 [2001:888:2000:d::a6]:47836
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33780

Show key headers only | View raw


On Wed, Nov 21, 2012 at 4:21 PM, Joshua Landau
<joshua.landau.ws@gmail.com> wrote:
> "{}".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.

I think it mostly depends on where you come from as a programmer.  As
you say, having two syntaxes muddles things up.  If you come from C or
C++, then the %s syntax feels natural and intuitive, and trying to
learn the sort-of-similar-but-not-really {} syntax on top of it is
just confusing.  Conversely, if you come from Java or C#, then the {}
syntax comes naturally, and having to learn %s in addition will give
one a headache.  And then there are those who come from Lisp and want
to know why they can't just use the familiarly easy ~a syntax.

None of these are really any easier than the others.  But they are
sort of similar at a superficial level, which just makes it that much
more painful to learn one when you're already accustomed to another.

I think my favorite example from the str.format documentation is this
one.  Apart from demonstrating the flexibility of the format system,
it also manages to mix the two systems in a most unholy way:

>>> import datetime
>>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)
>>> '{:%Y-%m-%d %H:%M:%S}'.format(d)
'2010-07-04 12:15:58'

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


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