Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99578
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Antoon Pardon <antoon.pardon@rece.vub.ac.be> |
| Newsgroups | comp.lang.python |
| Subject | Re: What does a list comprehension do |
| Date | Thu, 26 Nov 2015 15:26:47 +0100 |
| Lines | 29 |
| Message-ID | <mailman.141.1448548095.20593.python-list@python.org> (permalink) |
| References | <CAPTjJmpwjWnF=d6mpgbKS1biVLoR4APutgyH0n9t6CJ=Kh4dCg@mail.gmail.com> <877fldnm9z.fsf@handshake.de> <mailman.73.1448459485.20593.python-list@python.org> <pan.2015.11.26.11.13.43.440000@nowhere.invalid> <mailman.132.1448538769.20593.python-list@python.org> <87k2p4ex5x.fsf@elektro.pacujo.net> <mailman.138.1448544914.20593.python-list@python.org> <87fuzseuee.fsf@elektro.pacujo.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de XyWBE9HDAPkoGQLWtzKXpAbLAo033xodqxxGNFtooCeQ== |
| 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.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'received:134': 0.05; 'subject:skip:c 10': 0.07; 'works.': 0.07; 'mess': 0.09; 'semantics': 0.09; 'python': 0.10; 'python.': 0.11; '(lambda': 0.16; 'closures': 0.16; 'received:ac.be': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'rewritten': 0.16; "wouldn't": 0.16; 'changes': 0.20; 'java': 0.22; 'minor': 0.22; 'variables.': 0.22; 'consistent': 0.23; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'example': 0.26; 'subject:list': 0.26; 'btw,': 0.29; 'implicitly': 0.29; 'received:be': 0.30; 'interaction': 0.33; 'changing': 0.34; 'languages': 0.34; 'list': 0.34; 'follows:': 0.35; 'propose': 0.35; 'there': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'turned': 0.38; 'to:addr:python.org': 0.40; 'your': 0.60; 'share': 0.61; "you'll": 0.61; 'making': 0.62; 'between': 0.65; 'touch': 0.66; 'special': 0.73; 'pardon': 0.84; 'schreef': 0.84; 'proposal,': 0.95 |
| X-IronPort-Anti-Spam-Filtered | true |
| X-IronPort-Anti-Spam-Result | AnIJAEYWV1aGuA9G/2dsb2JhbABehFcBJb93hg8CgX4BAQEBAQGFQAEBAwEjVQYLCxoCBRYLAgIJAwIBAgFFEwYCAogiCK4tjBKEHAEBCAIhgQGFU4R+hSeCToFEBZZXjTWBXIc0j1yDcmOEBXEBhV8BAQE |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.8.0 |
| In-Reply-To | <87fuzseuee.fsf@elektro.pacujo.net> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:99578 |
Show key headers only | View raw
Op 26-11-15 om 14:56 schreef Marko Rauhamaa:
> Antoon Pardon <antoon.pardon@rece.vub.ac.be>:
>
>> I don't understand. What I propose would be a minor change in
>> how list comprehension works. I don't see how your example
>> can be turned into a list comprehension.
> The list comprehension is only a special case of the interaction between
> closures and variables. If you dabble with list comprehensions and
> lambdas, you'll need to make consistent changes in closure semantics.
It would only dabble with the list comprehension not with the lambda.
The effect of the change would only be that a list comprehension like
[ <expression> for <var> in <iter> ]
would implicitly be rewritten as follows:
[ (lambda <var>: <expression>)(<var>) for <var> in <iter>]
There would no change on how lambdas work or functions or closures.
> BTW, all(!?) other languages from Java to Scheme share closure semantics
> with Python so you would really be making a mess by changing Python.
Not this proposal, which wouldn't touch closure semantics.
--
Antoon.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What does a list comprehension do (was: Late-binding of function defaults (was Re: What is a function parameter =[] for?)) Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-25 14:51 +0100
Re: What does a list comprehension do (was: Late-binding of function defaults (was Re: What is a function parameter =[] for?)) Nobody <nobody@nowhere.invalid> - 2015-11-26 11:13 +0000
Re: What does a list comprehension do Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-26 12:52 +0100
Re: What does a list comprehension do Marko Rauhamaa <marko@pacujo.net> - 2015-11-26 14:56 +0200
Re: What does a list comprehension do Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-26 14:33 +0100
Re: What does a list comprehension do Marko Rauhamaa <marko@pacujo.net> - 2015-11-26 15:56 +0200
Re: What does a list comprehension do Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-26 15:26 +0100
Re: What does a list comprehension do Marko Rauhamaa <marko@pacujo.net> - 2015-11-26 17:36 +0200
Re: What does a list comprehension do Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2015-11-26 20:18 +0100
Re: What does a list comprehension do Jussi Piitulainen <harvest@is.invalid> - 2015-11-26 18:11 +0200
csiph-web