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


Groups > comp.lang.python > #53284

Re: semicolon at end of python's statements

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <antoon.pardon@rece.vub.ac.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'received:134': 0.05; 'that?': 0.05; 'odd': 0.07; 'suppose': 0.07; 'assuming': 0.09; 'function,': 0.09; 'lst': 0.09; 'shame': 0.09; 'translate': 0.10; 'python': 0.11; 'assume': 0.14; 'afair,': 0.16; 'better:': 0.16; 'clunky': 0.16; 'finney': 0.16; 'lambda': 0.16; 'loops': 0.16; 'notation': 0.16; 'statement.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'not,': 0.20; 'seems': 0.21; '>>>': 0.22; 'aug': 0.22; 'header:User-Agent:1': 0.23; 'exists': 0.24; 'rid': 0.24; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'thus': 0.29; "i'm": 0.30; 'towards': 0.31; '>>>>': 0.31; 'forces': 0.31; 'subject:end': 0.31; 'way?': 0.31; 'writes:': 0.31; 'regular': 0.32; 'quite': 0.32; 'fri,': 0.33; 'no,': 0.35; 'but': 0.35; 'sequence': 0.36; 'doing': 0.36; 'possible': 0.36; 'should': 0.36; 'behind': 0.37; 'turn': 0.37; 'list': 0.37; 'list.': 0.37; 'ben': 0.38; 'driving': 0.38; 'filter': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'expression': 0.60; 'course': 0.61; 'simple': 0.61; 'back': 0.62; 'kind': 0.63; 'map': 0.64; '30,': 0.65; 'charset:windows-1252': 0.65; 'introduction': 0.68; '5:15': 0.84; 'pardon': 0.84; 'sometimes.': 0.84; 'lazy': 0.91; 'incorporated': 0.95; '2013': 0.98
X-IronPort-Anti-Spam-Filtered true
X-IronPort-Anti-Spam-Result Ap4EABdNIFKGuA9G/2dsb2JhbABaxFyBNYMYAQEEATIBRQYLCxgJFg8JAwIBAgEPNhMGAgKHawMJBq91DVeIbI0FgnYWhAYDlgqBaYYYhh+FL4Mi
Date Fri, 30 Aug 2013 09:48:10 +0200
From Antoon Pardon <antoon.pardon@rece.vub.ac.be>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130116 Icedove/10.0.12
MIME-Version 1.0
To python-list@python.org
Subject Re: semicolon at end of python's statements
References <1377735506.18906.15.camel@debian> <mailman.347.1377760274.19984.python-list@python.org> <1FETt.52607$Mw4.14965@fx15.am4> <CAPTjJmpBbf=BkZdeg3VdBYFvB0ADtyseGAMB214jJDyqZa=pmQ@mail.gmail.com> <CAA=1kxR_pT=MsUSSk0v-oij-0hSh0LEYrrP5i+5MukmcYfOGWA@mail.gmail.com> <7wob8gywds.fsf@benfinney.id.au> <7wfvtrkcae.fsf@benfinney.id.au> <5220468E.4070407@rece.vub.ac.be> <CAPTjJmqj8FZq8mNnpP79MvEFHv7DNoeQNQmqSm3E18ahXT0bKA@mail.gmail.com>
In-Reply-To <CAPTjJmqj8FZq8mNnpP79MvEFHv7DNoeQNQmqSm3E18ahXT0bKA@mail.gmail.com>
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
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.383.1377848892.19984.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1377848892 news.xs4all.nl 15901 [2001:888:2000:d::a6]:43643
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53284

Show key headers only | View raw


Op 30-08-13 09:25, Chris Angelico schreef:
> On Fri, Aug 30, 2013 at 5:15 PM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> Op 30-08-13 06:55, Ben Finney schreef:
>>> Ben Finney <ben+python@benfinney.id.au> writes:
>>>
>>>> Fábio Santos <fabiosantosart@gmail.com> writes:
>>>>
>>>>> It is a shame that this is not possible in python. for..if exists in
>>>>> comprehensions and not in regular loops but that would be nice
>>>>> sometimes.
>>>>     for foo in (spam for spam in sequence if predicate(spam)): …
>>>
>>> Better:
>>>
>>>     for foo in filter(predicate, sequence):
>>>         process(foo)
>>
>> Well better in what way? You now have to translate a predicate
>> expression into a predicate function. Which AFAIU was one of
>> the reasons to move away from map/filter to list comprehension.
>>
>> As I understand it, python made a move away from map and filter
>> towards list comprehension. Chris seems to want some of the
>> possibilities that came with that incorporated into the for
>> statement. And your suggestion is to go back to the old kind
>> of filter way.
> 
> No, actually Ben's quite right - assuming the predicate is a simple
> function,

But why should we assume that? Suppose I would like to process all
odd items in a list. A comprehension kind of notation would be

|  for item in lst if item % 2:
|      process items

Which we would have to turn into

|  for item in filter(lambda nr: nr % 2, lst):
|      process items

But AFAIR, one of the driving forces behind the introduction to list
comprehension, and thus a move away from map and filter was to get rid
of the lambda's in this kind of situations.

> of course (Python's lambda notation is a bit clunky for
> comparisons); as of Python 3, filter() is lazy and is pretty much what
> I'm doing here.

Lazy or not, is AFAICS, not a point here.

-- 
Antoon Pardon

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


Thread

Re: semicolon at end of python's statements "Sam Fourman Jr." <sfourman@gmail.com> - 2013-08-28 22:10 -0400
  Re: semicolon at end of python's statements Alister <alister.ware@ntlworld.com> - 2013-08-29 09:39 +0000
    Re: semicolon at end of python's statements Chris Angelico <rosuav@gmail.com> - 2013-08-29 19:52 +1000
    Re: semicolon at end of python's statements Fábio Santos <fabiosantosart@gmail.com> - 2013-08-29 11:02 +0100
    Re: semicolon at end of python's statements Ben Finney <ben+python@benfinney.id.au> - 2013-08-30 08:17 +1000
    Re: semicolon at end of python's statements Chris Angelico <rosuav@gmail.com> - 2013-08-30 08:50 +1000
    Re: semicolon at end of python's statements Ben Finney <ben+python@benfinney.id.au> - 2013-08-30 14:55 +1000
    Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-30 09:15 +0200
    Re: semicolon at end of python's statements Chris Angelico <rosuav@gmail.com> - 2013-08-30 17:25 +1000
    Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-30 09:48 +0200
    Re: semicolon at end of python's statements Fábio Santos <fabiosantosart@gmail.com> - 2013-08-30 11:32 +0100
      Re: semicolon at end of python's statements Roy Smith <roy@panix.com> - 2013-08-30 06:53 -0400
        Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-08-30 16:14 +0200
        Re: semicolon at end of python's statements Chris Angelico <rosuav@gmail.com> - 2013-08-31 08:18 +1000
      Re: semicolon at end of python's statements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-31 00:09 +0000
        Re: semicolon at end of python's statements Terry Reedy <tjreedy@udel.edu> - 2013-08-31 01:03 -0400
        Re: semicolon at end of python's statements Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-08-31 10:47 +0300
          Re: semicolon at end of python's statements Paul Rudin <paul.nospam@rudin.co.uk> - 2013-08-31 09:00 +0100
            Re: semicolon at end of python's statements Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-08-31 13:28 +0300
            Re: semicolon at end of python's statements Grant Edwards <invalid@invalid.invalid> - 2013-09-02 14:20 +0000
              Re: semicolon at end of python's statements Tim Chase <python.list@tim.thechases.com> - 2013-09-02 09:45 -0500
                Re: semicolon at end of python's statements Roy Smith <roy@panix.com> - 2013-09-02 10:47 -0400
                Re: semicolon at end of python's statements Tim Chase <python.list@tim.thechases.com> - 2013-09-02 12:58 -0500
                Re: semicolon at end of python's statements Chris Angelico <rosuav@gmail.com> - 2013-09-03 07:07 +1000
        Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-01 19:58 +0200
        Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-01 21:58 +0200
          Re: semicolon at end of python's statements Steven D'Aprano <steve@pearwood.info> - 2013-09-02 08:05 +0000
            Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-02 11:45 +0200
            Re: semicolon at end of python's statements Fábio Santos <fabiosantosart@gmail.com> - 2013-09-02 11:42 +0100
            Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-02 12:58 +0200
            Re: semicolon at end of python's statements "albert visser" <albert.visser@gmail.com> - 2013-09-02 19:44 +0200
              Re: semicolon at end of python's statements Roy Smith <roy@panix.com> - 2013-09-02 13:53 -0400
                Re: semicolon at end of python's statements Neil Cerutti <neilc@norwich.edu> - 2013-09-03 17:15 +0000
                Re: semicolon at end of python's statements Neil Cerutti <neilc@norwich.edu> - 2013-09-03 20:00 +0000
            Re: semicolon at end of python's statements Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-09-02 17:24 -0400
        Re: semicolon at end of python's statements MRAB <python@mrabarnett.plus.com> - 2013-09-02 00:30 +0100
        Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-02 10:29 +0200
          Re: semicolon at end of python's statements Steven D'Aprano <steve@pearwood.info> - 2013-09-02 09:52 +0000
            Re: semicolon at end of python's statements Chris Angelico <rosuav@gmail.com> - 2013-09-02 20:14 +1000
              Re: semicolon at end of python's statements Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-02 14:57 +0000
            Re: semicolon at end of python's statements Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-09-02 12:52 +0200
            Re: semicolon at end of python's statements Modulok <modulok@gmail.com> - 2013-09-02 17:17 -0600
              Re: semicolon at end of python's statements Roy Smith <roy@panix.com> - 2013-09-02 19:54 -0400
                Re: semicolon at end of python's statements Modulok <modulok@gmail.com> - 2013-09-02 18:56 -0600

csiph-web