Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.06; 'executable': 0.09; 'latter': 0.09; 'subject:language': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'language.': 0.14; "wouldn't": 0.14; '"just"': 0.16; 'baskets.': 0.16; 'comma': 0.16; 'evaluates': 0.16; 'expression,': 0.16; 'expression.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'materially': 0.16; 'operator).': 0.16; 'research)': 0.16; 'semantics': 0.16; 'semicolon': 0.16; 'subject: \n ': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'implementing': 0.19; 'example': 0.22; 'programming': 0.22; 'cc:addr:python.org': 0.22; 'large,': 0.24; 'lets': 0.24; 'phd': 0.24; 'prototype': 0.24; 'rapidly': 0.24; 'math': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; "i've": 0.25; 'developing': 0.27; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; '[1]': 0.29; 'am,': 0.29; '(like': 0.30; '???': 0.30; 'programming.': 0.30; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'code': 0.31; '(although': 0.31; 'though.': 0.31; 'covered': 0.32; 'supposed': 0.32; 'another': 0.32; 'text': 0.33; 'up.': 0.33; 'ago': 0.33; 'maybe': 0.34; "i'd": 0.34; 'could': 0.34; "can't": 0.35; 'tool': 0.35; 'something': 0.35; '(2)': 0.35; 'etc': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'are,': 0.36; 'done,': 0.36; 'scheme': 0.36; 'sequence': 0.36; 'done': 0.36; "i'll": 0.36; 'area': 0.37; 'easily': 0.37; 'being': 0.38; 'that,': 0.38; 'anything': 0.39; 'recent': 0.39; 'expensive': 0.39; 'even': 0.60; 'consists': 0.60; 'new': 0.61; 'show': 0.63; 'costs': 0.63; 'today': 0.64; 'more': 0.64; 'needing': 0.65; 'talking': 0.65; 'between': 0.67; 'physics': 0.68; 'opinions': 0.70; 'brand': 0.72; 'analysis': 0.75; 'paper': 0.75; 'lack': 0.78; 'subject:this': 0.83; 'different.': 0.84; 'irrelevant': 0.84; 'to:none': 0.92; 'mistakes': 0.93 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:cc :content-type; bh=c/3+AXhNXGMSPi2t8P8GXR8zMmPIpbYme9aOLdMkvdM=; b=k0OrP2BOtzYJ+WySYvuQHvslMWAK7XIlPnI7Gf2vcmNwTYo5snSphfdeIkACt6BlHx IZV8bPW+BgifvQkz1TCP5f7N+qOG9vHO9tHKWT8Sccr1YKvNio4fuvRJ4YITyYSZCFvU /FmK3HY2rPlSRryXqGe/AUrYEL3Dm49LxUc8kef5zxmsY1TOsg0LGZOeyItmpq7j15qY 0N62eW3tddEOf4pm3jjn5lerW1yroi+AWM3BhuvjgX4eFk2gw2F2uWqMDCOgWzyzNWrz PBjR+MuK84/NtmqauO6WbnTtDMyCGVaHFvNO1sUI0mA19t1SfWhMjN9QwlLP6XAOt3i2 tB4A== MIME-Version: 1.0 X-Received: by 10.68.135.99 with SMTP id pr3mr23587395pbb.99.1396806855677; Sun, 06 Apr 2014 10:54:15 -0700 (PDT) In-Reply-To: <38795bc9-f67d-423f-a929-212b6b38ec8c@googlegroups.com> References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <5334c38e$0$29994$c3e8da3$5496439d@news.astraweb.com> <53364327$0$29994$c3e8da3$5496439d@news.astraweb.com> <53365F55.2040302@gmail.com> <533836c4$0$29994$c3e8da3$5496439d@news.astraweb.com> <533e811a$0$29993$c3e8da3$5496439d@news.astraweb.com> <874n26su9f.fsf@elektro.pacujo.net> <53418644$0$29993$c3e8da3$5496439d@news.astraweb.com> <38795bc9-f67d-423f-a929-212b6b38ec8c@googlegroups.com> Date: Mon, 7 Apr 2014 03:54:15 +1000 Subject: Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 60 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396806858 news.xs4all.nl 2867 [2001:888:2000:d::a6]:35846 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69774 On Mon, Apr 7, 2014 at 3:31 AM, Rustom Mody wrote: > However consider that some of the things that people did around 40 years > ago and do today > > - use FORTRAN for numerical/simulation work -- now use scipy/sage etc > - NLP with Lisp/Prolog -- look at Nltk > - ??? with Data Analysis in Pandas > - Scheme (basis for programming pedagogy, semantics research) -> Python > > you can add/multiply ad libitum > > Yeah you covered this in your (2) as "...just a tool..." > > Ask some recent PhD about what is for you "just" an almost irrelevant > tool and you are very likely to find that that choice may well have > been the difference between completing the research and giving up. > > I think python wins because it (usually) lets people do their thing Allow me to put it another way. Mathematicians use the language of algebra to describe their research; they don't, by and large, use a programming language. They use pencils and paper [1] as tools to get their work done, and may well have strong opinions on which pencil brand is the best, but the point of the pencil (pun intended) is to enable something else. It's supposed to get out of the way and let them do their thing. Python is highly practical because it gets out of the way. It's not the way that you develop programming language theory, though. I might start out designing a language with the express purpose of implementing everything as an expression. The whole program consists of one long expression, with perhaps the semicolon being a sequence point that evaluates its left side, then evaluates its right side, and returns the latter (like the C comma operator). I could then go through a whole lot of lovely mental exploration as to what the benefits and costs of that system are, all the while writing nothing more than design documents and example code. At some point, if I'm happy with it, I'll write a reference implementation, and maybe then I'll use Python for the job. But that's not using Python to explore a language concept; that's using Python to rapidly prototype the executable code that I need in order to show my new language at work. All the work of developing the language is done in the design stage, with nothing at all even needing a computer (although I *guarantee* you that if I were to start something like that, I'd find part way through that I've made some fundamental mistakes early on - and a computer is better for editing text than anything on paper). I could just as easily write my reference implementation using yacc/bison and C, and it wouldn't be materially different. Using Python at the design stage would be what Steven's talking about - actually using it to build the theory of programming. I have about as much experience in the area as he has, so we can't speak to the lack of examples, but that's the sort of example it would take. ChrisA [1] As the old joke goes: The physics department needs a whole lot of expensive equipment, but the math department needs only pencils, paper, and wastepaper baskets. And the philosophy department goes even further: they don't need wastepaper baskets.