Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46524
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'programmer': 0.03; 'subject:Python': 0.06; 'puts': 0.07; '*is*': 0.09; 'statements': 0.09; 'subject:How': 0.10; 'translate': 0.10; 'url:blog': 0.10; 'python': 0.11; '(int': 0.16; 'alexander': 0.16; 'be:': 0.16; 'conditional': 0.16; 'foo"': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'haskell,': 0.16; 'insightful': 0.16; 'iteration,': 0.16; 'saying.': 0.16; 'sees': 0.16; 'syntactic': 0.16; 'syntax,': 0.16; 'url:browse_thread': 0.16; 'url:thread': 0.16; 'followed': 0.16; 'wrote:': 0.18; 'discussion': 0.18; 'result.': 0.19; 'example': 0.22; 'programming': 0.22; '31,': 0.24; 'header': 0.24; 'post': 0.26; 'subject:/': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'probably': 0.32; 'fri,': 0.33; 'comment': 0.34; '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; 'useful': 0.36; 'subject:?': 0.36; 'similar': 0.36; 'url:org': 0.36; 'should': 0.36; 'example,': 0.37; 'two': 0.37; 'list': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'explain': 0.39; 'functional': 0.39; 'url:2012': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'mailing': 0.39; 'skip:x 10': 0.40; 'skip:u 10': 0.60; 'numbers': 0.61; 'simple': 0.61; 'making': 0.63; 'such': 0.63; 'url:group': 0.63; 'more': 0.64; '30,': 0.65; '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=76eVcZFp4b55VCuMFCvWZkUmWMbEIBmPbaciuBYHb4I=; b=rpjQWlZ/dUU94g1rp5bpbckX7UMosQu54n5Zz8Z8MlVosEMbvVyPkDUbwIaOwLCWgo dJFZaLcJ8NKIzYSpRogZBw+X7YrhvW4ylkRPT/R0qOPZPHD09dkSjTDZg0jCaeN4X0lY K7Vgx2xNNM/6gX+ilCpkNmyIF2J+3JPcWQyV9LJpEJmxRT0n6EwPN7PxQ+bRfLoAUGv7 YwG/6ip4zRuULuz/oOat0EysdJKA28gDGeNaBpzGyrtdyoknLd2VyBTFD3UkfBGSm8Vy FHM0qz+khR2iylo8EmZg9lXtsXhRk3Xc75caJEq5Ds5fL1GdJyn+0ygb/truQKG3k2ja tnSg== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.215.73 with SMTP id hd9mr6811063vcb.19.1369938170172; Thu, 30 May 2013 11:22:50 -0700 (PDT) |
| In-Reply-To | <034f2ffa-6bb3-453a-a0f2-b90ecafcda1e@qn4g2000pbc.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> <mailman.2434.1369934893.3114.python-list@python.org> <034f2ffa-6bb3-453a-a0f2-b90ecafcda1e@qn4g2000pbc.googlegroups.com> |
| Date | Fri, 31 May 2013 04:22:50 +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.2441.1369938179.3114.python-list@python.org> (permalink) |
| Lines | 53 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1369938179 news.xs4all.nl 15945 [2001:888:2000:d::a6]:56339 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:46524 |
Show key headers only | View raw
On Fri, May 31, 2013 at 3:59 AM, rusi <rustompmody@gmail.com> wrote:
> On May 30, 10:28 pm, Chris Angelico <ros...@gmail.com> wrote:
>> On Fri, May 31, 2013 at 3:12 AM, rusi <rustompm...@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
>
> I had a blog post about line-length in programs
> http://blog.languager.org/2012/10/layout-imperative-in-functional.html
>
> followed by an interesting discussion on the haskell mailing list
> http://groups.google.com/group/haskell-cafe/browse_thread/thread/f146ec7753c5db56/09eb73b1efe79fec
>
> The comment by Alexander Solla was insightful and is probably what you
> are saying.
>
> [Probably!! I am not sure what you are saying!]
Unfortunately a lot of your code specifics don't mean much to me
because I don't speak Haskell, but you are making several similar
points. A line of code should not be defined by the language's syntax,
but by the programmer's intention. A Python example might be:
for x in filter(lambda x: x%5 and x%6,range(40)):
# do something with the numbers that don't count by 5 or 6
Stupid example, but it still puts the conditional inside the loop
header. I'm sure you can come up with a more useful case!
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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