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


Groups > comp.lang.python > #46516

Re: How clean/elegant is Python's syntax?

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; 'programmer': 0.03; 'subject:Python': 0.06; '*is*': 0.09; 'statements': 0.09; 'subject:How': 0.10; 'translate': 0.10; '(int': 0.16; 'foo"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iteration,': 0.16; 'sees': 0.16; 'syntactic': 0.16; 'wrote:': 0.18; 'result.': 0.19; 'programming': 0.22; '31,': 0.24; 'header': 0.24; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'probably': 0.32; 'fri,': 0.33; 'trouble': 0.34; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'c++': 0.36; 'done': 0.36; 'subject:?': 0.36; 'example,': 0.37; 'two': 0.37; 'list': 0.37; 'sometimes': 0.38; 'to:addr:python- list': 0.38; 'explain': 0.39; 'functional': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'simple': 0.61; 'such': 0.63; 'between': 0.67; 'line,': 0.68; 'wish': 0.70; 'as:': 0.81; 'filtered': 0.84; 'rusi': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=Wbt7+xTEKYvuYY6YVhY8OGW0YO9pXQltnhkftRIi8RM=; b=taNowpRTBJD2Z3Y3QSVIAD0549cEhMCQT3c5HFlehwH89PGaSNMSMtjNgjjWMitxq4 zjgroe4N2LAe7K27RwWLbpZQbgO50dJU2Bou00CGuXJ1OV/+4mm55hXNzs27MhB5Ut9v 23VADggJP07VXe+FSlCB0MInzho+7CvbEsImfo1X0+Zq338EMob9UnBZF6igZb3E8Cuv N6UIJXqucVPivShX8SJvUq1pE4Of/lWAAPzcb0MagSeMQxv1+ZovO6e44g3JelIStLAt LGklIgRAD5AMtzQYU+gAFyKZp1mAWah/BNMQfeEU/Jz132wCLuERm9HG4ak3I9qbnuCX n3NQ==
MIME-Version 1.0
X-Received by 10.220.106.74 with SMTP id w10mr6564271vco.32.1369934891008; Thu, 30 May 2013 10:28:11 -0700 (PDT)
In-Reply-To <503a1a1e-9c5c-4c01-929b-673421907ab8@ys5g2000pbc.googlegroups.com>
References <CAGVx7UWXAFHSHq37Ep-Vk=cM2wYrEGHSUhNc8s43bCvj_VcVow@mail.gmail.com> <mailman.2374.1369852683.3114.python-list@python.org> <51a6ef42$0$11118$c3e8da3@news.astraweb.com> <mailman.2397.1369904083.3114.python-list@python.org> <503a1a1e-9c5c-4c01-929b-673421907ab8@ys5g2000pbc.googlegroups.com>
Date Fri, 31 May 2013 03:28:10 +1000
Subject Re: How clean/elegant is Python's syntax?
From Chris Angelico <rosuav@gmail.com>
To 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.2434.1369934893.3114.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369934893 news.xs4all.nl 15899 [2001:888:2000:d::a6]:48502
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46516

Show key headers only | View raw


On Fri, May 31, 2013 at 3:12 AM, rusi <rustompmody@gmail.com> wrote:
> You associate the primal (f)act of thinking about programming with
> *doing* the generating.
> By contrast the functional programmer thinks about what *is* the
> result.

I wish you'd explain that to my boss :) He often has trouble
understanding why sometimes I put two syntactic statements on one
line, such as:

for (int i=0;i<nfoo;++i) if (foo[i].marker)
{
    //do something with foo[i]
}

In Python, that would probably be done with a list comprehension or
some other form of filtered iteration, and is to my mind a single
operation - "iterate over all the marked foo" is just as much a valid
loop header as "iterate over all the foo". This is a simple example,
and what you say about thinking about what *is* the result doesn't
really translate well into a C++ example, but the broader concept
applies: there's a difference between code as the compiler/interpreter
sees it and code as the programmer sees it, and there is not always a
1:1 correspondence of statements.

ChrisA

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


Thread

Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-30 02:37 +0800
  Re: How clean/elegant is Python's syntax? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-30 06:18 +0000
    Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-30 16:54 +0800
      Re: How clean/elegant is Python's syntax? rusi <rustompmody@gmail.com> - 2013-05-30 10:12 -0700
        Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 03:28 +1000
          Re: How clean/elegant is Python's syntax? rusi <rustompmody@gmail.com> - 2013-05-30 10:59 -0700
            Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 04:22 +1000
        Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-31 01:46 +0800
        Re: How clean/elegant is Python's syntax? Chris Angelico <rosuav@gmail.com> - 2013-05-31 03:50 +1000
        Re: How clean/elegant is Python's syntax? Ma Xiaojun <damage3025@gmail.com> - 2013-05-31 01:50 +0800
        Re: How clean/elegant is Python's syntax? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-30 19:36 +0000
    Re: How clean/elegant is Python's syntax? Michael Torrie <torriem@gmail.com> - 2013-05-30 17:30 -0600

csiph-web